Very nice, this is a new platform that’s been deployed, recently. Could very well have to do with it being beta.
If I paste in my code which I originally wrote on replit 6 months ago, it passes. So basically, it seems ok, but maybe something in your implementation is causing a problem. It’s certainly a bit more complicated than mine (with functions like _deposit
)
For example, if I print a test, and then paste in your init code, everything is ok:
print("test")
class Category:
def __init__(self, name):
self.name = name
self.ledger = []
the console shows “test” but if I paste in just one more function, it breaks, and no longer prints test.
print("test")
class Category:
def __init__(self, name):
self.name = name
self.ledger = []
def __str__(self) -> str:
to_string = '{:*^30}\n'.format(self.name)
for entry in self.ledger:
amount_str = f' {format(entry["amount"], '.2f')}'
desc_str = '{:<30}'.format(entry["description"])
trim_index = 30 - len(amount_str)
to_string += f'{desc_str[:trim_index]}{amount_str}\n'
to_string += f'Total: {self._get_balance ()}'
return to_string
“test” is no longer printed. If I do similar tests with my own code “test” always prints ok.
So, I don’t think any of the code is being run, which makes sense for it to fail all the tests when it passes it all locally, there’s some kind of fatal error before it runs the tests.
If I comment out this line, it works:
amount_str = f' {format(entry["amount"], '.2f')}'
that line gets an error on google colab:
File "<ipython-input-4-07c51ac8a64c>", line 9
amount_str = f' {format(entry["amount"], '.2f')}'
^
SyntaxError: invalid decimal literal