I'm running a series of unit tests on an RPN calculator I've just put together. This calculator can mix integers, floats, and picas. I often need to be able to calculate using picas for some typesetting work I'm doing.
For some reason, one of my unit tests is failing:
Failure
Traceback (most recent call last):
File "/Users/andrew/Developer/pyRpn/test_rpn.py", line 112, in test_pica_subtracted_from_pica
self.assertEqual(self.calc.rpn(['10p3', '2p1', '-']), ['8p2'])
AssertionError: Lists differ: ['8p2'] != ['8p2']
First differing element 0:
'8p2'
8p2
['8p2']
I can't see why. To simplify I took the list out of the equation and compared directly to a string:
Failure
Expected :'8p2'
Actual :'8p2'
<Click to see difference>
Traceback (most recent call last):
File "/Users/andrew/Developer/pyRpn/test_rpn.py", line 112, in test_pica_subtracted_from_pica
self.assertEqual(self.calc.rpn(['10p3', '2p1', '-']).pop(), '8p2')
AssertionError: '8p2' != '8p2'
It still fails. I cannot see why '8p2' != '8p2'
. Running in PyCharm if I click to see the difference, it tells me there are no differences, and the content is identical, yet the test fails. It fails from the command line as well.
I've put the same test in as a doctest:
"""
>>> RPN().rpn(['10p3', '2p1', '-'])
['8p2']
"""
and it passes without a problem.
What am I missing?
Aucun commentaire:
Enregistrer un commentaire