[New-bugs-announce] [issue14025] unittest.TestCase.assertEqual does not show diff when comparing str with unicode
report at bugs.python.org
Wed Feb 15 22:00:00 CET 2012
New submission from Jaap Karssenberg <jaap.karssenberg at gmail.com>:
When you compare two multiline strings with unittest.TestCase.assertEqual it is supposed to dispatch to assertMultiLineEqual and show a diff when the strings differ.
However this only works for two string of the same type (str or unicode). But mixing the two will just give the default message that they differ without the diff. THis is due to the way the dispatch checks types. Probably need to make an exception for comparing str with unicode.
Note that if the contents of both strings are the same, the assert will regard them equal, so it is not a strict check on the type perse.
components: Library (Lib)
title: unittest.TestCase.assertEqual does not show diff when comparing str with unicode
versions: Python 2.7
Python tracker <report at bugs.python.org>
More information about the New-bugs-announce