Tell us what’s happening:
Hi. Please can you provide some guidance on why the code linked below fails 2 of the 11 unit tests in the main.py file? As far as I can tell, the format of the table and chart matches the examples given in the read-me file, however the unit tests that fail state that the format of both is incorrect. Thanks!!
======================================================================
FAIL: test_to_string (test_module.UnitTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/home/gray/src/work/fcc-sc-budget/test_module.py", line 131, in test_to_string
self.assertEqual(
AssertionError: '****[77 chars]s, bac -45.67\nTransfer to Entertainme -20.00\nTotal: 834.33\n' != '****[77 chars]s, bac -45.67\nTransfer to Entertainme -20.00\nTotal: 834.33'
*************Food*************
deposit 900.00
milk, cereal, eggs, bac -45.67
Transfer to Entertainme -20.00
- Total: 834.33
? -
+ Total: 834.33 : Expected different string representation of object.
In this one, the AssertionError is showing that the actual string has a newline and the expected one doesn’t. It also tries to show you this on the lines beginning with -, ?, and +.
The second is a little trickier. You need to set self.maxDiff to None to see the results, part of which is:
- 0| o o o
+ 0| o o o
? +
----------
- B F E
+ B F E
? +
which with coloration, shows that your lines (-) are missing a space compared to the expected lines (+).