Python Budget App: Maybe bug in test_module.py

The problem is about the check_funds function.
Let’s see what does it returns
A check_funds method that accepts an amount as an argument. It returns False if the amount is less than the balance of the budget category and returns True otherwise. This method should be used by both the withdraw method and transfer method. (from README.md)

but in test_check_funds,
self.food.deposit(10, "deposit")
actual = self.food.check_funds(20)
expected = False
self.assertEqual(actual, expected, 'Expected 'check_funds' method to be False')

May I ask why it is expected to return False? Isn’t that the parameter passed in is larger than the amount in self.food?

Do I misunderstand anything?

Thanks.

you have just deposited 10 in the food category:

then check if you can use 20

well, you can’t use 20 if you have only 10

amount < balance

means:

amount I take away WITHIN amount I have

means:

I take a part of my money off

means:

Valid

means:

should return True

Conclusion: amount < balance returns True.

Contradiction happens.

uh, seems someyhing got switched there, you are right

Thank you for helping make FCC better. Bugs can be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

1 Like

I got caught on this for a bit I fixed it then I got caught on the 10 -10 = 0