Budget-app: Failing return True/False tests in replit

Hi,

I keep failing 5 tests (ones which require the function to return True/False): test_check_funds, test_transfer, test_transfer_no_funds, test_withdraw_no_description, and test_withdraw_no_funds

The error message is all different variations of the one below:

I don’t know why it’s saying None != True/False for all of them, clearly it’s seeing the True/False returns for the tests I’m passing. I also find it interesting that the “check” is offset by one, if it started one return sooner I would pass these tests.

When I do these tests individually in pycharm, I get the right returns.

I’m using the check_funds() function at the beginning of the withdraw() and transfer() functions, and check_funds() prints print(bool(True)) or print(bool(False)) as appropriate.

I’m at a loss, thanks for your help!

Since I can only embed one image in a post, here’s what I mean about the offset check:

You don’t really need to use “print()” except for your own testing and troubleshooting. The app needs you to “return” certain values.

You are getting “None != True/False” because you aren’t using “return” so your app is returning None. The tests aren’t reading what you send to “print()”

I see, I thought return True/False wasn’t working because I wasn’t seeing it in the console output and I had other problems with how check_funds() was being called. Fixed now, thank you!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.