Hey everybody,
it seems like I can’t figure out why my code fails on two tests. Even though I can’t see a difference in the terminal prints. I posted my link below. I’m also grateful for any advice how to read the comments on why it failed better. Because I feel like I should be able to figure that one out myself, but I’m a bit lost.
Thanks for any advice!
Thanks a lot. Replacing the spaces by a visible character is a great idea and helped a lot, and I found a few mistakes. I appreciate that.
Sadly, there is still an issue I can’t figure out. Like you said, the unittest says the percentages are wrong. But when I use the same setup as in the test and compare the expected string with my created string, they are exact the same (You can see it in my et.py). So I don’t know how to fix this issue. I would really appreciate a hint on how to approach this issue.
et.py:
import budget
from budget import create_spend_chart
business = budget.Category("Business")
food = budget.Category("Food")
entertainment = budget.Category("Entertainment")
# the settings from the test case from test_module.py
food.deposit(900, "deposit")
entertainment.deposit(900, "deposit")
business.deposit(900, "deposit")
food.withdraw(105.55)
entertainment.withdraw(33.40)
business.withdraw(10.99)
# string created by using my budget.py
string_from_budget_app = create_spend_chart(budget.Category.categories)
string_from_test_module = "Percentage spent by category\n100| \n 90| \n 80| \n 70| o \n 60| o \n 50| o \n 40| o \n 30| o \n 20| o o \n 10| o o \n 0| o o o \n ----------\n B F E \n u o n \n s o t \n i d e \n n r \n e t \n s a \n s i \n n \n m \n e \n n \n t "
print(string_from_budget_app, string_from_test_module)
print(string_from_test_module == string_from_test_module)
Print:
Percentage spent by category
100|
90|
80|
70| o
60| o
50| o
40| o
30| o
20| o o
10| o o
0| o o o
----------
B F E
u o n
s o t
i d e
n r
e t
s a
s i
n
m
e
n
t
Percentage spent by category
100|
90|
80|
70| o
60| o
50| o
40| o
30| o
20| o o
10| o o
0| o o o
----------
B F E
u o n
s o t
i d e
n r
e t
s a
s i
n
m
e
n
t
True