[Python-modules-team] Bug#732679: test_nodes.ElementTests.test_empty fails for py3: "=?UTF-8?Q?=E2=80=A2?=" != "\\u2022"

Jakub Wilk jwilk at debian.org
Fri Dec 20 09:36:56 UTC 2013


Control: severity -1 serious

The bug makes the package FTBFS, so I bumped severity.

>The most likely cause is the 2to3 conversion of the test. The original code
>alreaydy differs between 2 and 3:
>
>        if sys.version_info < (3,):
>            self.assertEqual(str(element), '<Element mark="\\u2022"/>')
>        else:
>            self.assertEqual(str(element), '<Element mark="\u2022"/>')

The last line should have probably been:

self.assertEqual(str(element), u'<Element mark="\u2022"/>')

>But in test3/, 2to3 mangles this to
>
>        if sys.version_info < (3,):
>            self.assertEqual(str(element), '<Element mark="\\u2022"/>')
>        else:
>            self.assertEqual(str(element), '<Element mark="\\u2022"/>')

...then it would be correctly converted to:

self.assertEqual(str(element), '<Element mark="\u2022"/>')

In the past it worked only by accident, due to a bug:
http://bugs.python.org/issue18037

-- 
Jakub Wilk



More information about the Python-modules-team mailing list