Tell us what’s happening:
Hi, I’m having some problems with my create_spend_chart function. The chart seems to match the expected one perfectly but I guess there must be some whitespace issues or something. Could I get some help understanding the error I get from the test suite? I’ll post my code if necessary. Thank you.
If it helps I’m filling every line one by one (with a loop) and then I add them to a single string to return, like so:
for m in lines:
finalprint += ‘\n’+m
return finalprint
Your code so far (the error I get)
Traceback (most recent call last):
File "/home/runner/boilerplate-budget-app/test_module.py", line 102, in test_create_spend_chart
self.assertEqual(actual, expected, 'Expected different chart representation. Check that all spacing is exact.')
AssertionError: 'Perc[25 chars]n100|\n 90|\n 80|\n 70| o \n 60| o [298 chars] t ' != 'Perc[25 chars]n100| \n 90| \n 80| [349 chars] t '
Percentage spent by category
- 100|
- 90|
- 80|
+ 100|
+ 90|
+ 80|
- 70| o
+ 70| o
? +
- 60| o
+ 60| o
? +
- 50| o
+ 50| o
? +
- 40| o
+ 40| o
? +
- 30| o
+ 30| o
? +
- 20| o o
+ 20| o o
? +
- 10| o o
+ 10| o o
? +
- 0| o o o
+ 0| o o o
? +
----------
- B F E
+ B F E
? +
- u o n
+ u o n
? +
- s o t
+ s o t
? +
- i d e
+ i d e
? +
- n r
+ n r
? +
- e t
+ e t
? +
- s a
+ s a
? +
- s i
+ s i
? +
- n
+ n
? +
- m
+ m
? +
- e
+ e
? +
- n
+ n
? +
- t + t ? +
: Expected different chart representation. Check that all spacing is exact.
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0
Challenge: Scientific Computing with Python Projects - Budget App
Link to the challenge: