I am doing a unit test in Python for my program and I would like to do an assertEquals
test.
My code looks something like this:
class UnitTest(unittest.TestCase):
def test_parser(self):
self.assertEquals(parser,"some long string", "String is not equal")
However, as my string is too long, I got something like testing[471 chars]0 != testing[473 chars]
. I wanna see what is the exact difference between both the strings instead of seeing the truncated ones.
Anyone has an idea how to counter this problem?
So, I landed on this question because I had an issue where I was using assertEqual()
and self.maxDiff = None
wouldn't cause the full output to be displayed. Tracing through, it turned out that because the types of the two objects were different (one was a list, one was a generator), the code path that would make use of self.maxDiff
wasn't used. So, if you run into the issue where you need the full diff and self.maxDiff
isn't working, ensure the types of your two compared objects are the same.