Budget app failing to pass 2 tests

https://replit.com/@twoochaynz/boilerplate-budget-app-1#budget.py

I’m sorry in advance if my code is a little rough I am still fairly new to this and am trying to complete these projects without looking at other code for help. I have been messing around with this one over the past couple days and cant get two of the tests to pass and I’m not sure I understand the error codes correctly…

Any help would be greatly appreciated! :slight_smile:

For the string test, the test calls str(obj) on an object of class Category that you define. str(obj) does not call the class’s to_string method, but rather another function in a standardized location. Check the documentation for str().

For the category test, set the self.maxDiff = None for the test and look at the difference. You’re missing some of the bars. Your percents should be the percent in each category of the total spent, not the percent spent of each category’s budget.

1 Like

Thank you @jeremy.a.gray for your quick reply! after doing some tinkering I have managed to get it to pass all the tests :smiley:

setting the self.maxDiff = None is a nice little trick that helped me quite a lot in understanding where I was going wrong.

After doing some research into this i think I understand that you need to define a str method in your class to make this possible? If not it worked for now and I will hopefully continue to get better with every code :sweat_smile:

Thanks again for your time and help!

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