[issue3955] maybe doctest doesn't understand unicode_literals?
Christoph Burgmer
report at bugs.python.org
Mon Jun 29 21:19:41 CEST 2009
Christoph Burgmer <cburgmer at ira.uka.de> added the comment:
OutputChecker.check_output() seems to be responsible for comparing
'example.want' and 'got' literals and this is obviously done literally.
So as "u'1'" is different to "'1'" this is reflected in the result.
This gets more complicated with literals like "[u'1', u'2']" I believe.
So, eval() could be used for testing for equality:
>>> repr(['1', '2']) == repr([u'1', u'2'])
False
but
>>> eval(repr(['1', '2'])) == eval(repr([u'1', u'2']))
True
doctests are already compiled and executed, but evaluating the doctest
code's result is probably a security issue, so a method doing the
invers of repr() could be used, that only works on variables; something
like Pickle, but without its own protocol.
----------
nosy: +christoph
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue3955>
_______________________________________
More information about the Python-bugs-list
mailing list