This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Doctest failing when it should pass
Type: Stage:
Components: Library (Lib) Versions: Python 2.5
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: Nosy List: georg.brandl, pupeno
Priority: normal Keywords:

Created on 2008-09-26 19:55 by pupeno, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
failingdoctest.py pupeno, 2008-09-26 19:55 Reproduction of the bug.
Messages (2)
msg73882 - (view) Author: J. Pablo Fernández (pupeno) Date: 2008-09-26 19:55
The attached file contains a function and two tests for it which are
essentially the same. One is a doctest and the other is a TestCase. The
doctest fails and I believe it shouldn't.

Here's what I get:

$ python failingdoctest.py 
**********************************************************************
File "../../provizora/failingdoctest.py", line 8, in __main__._to_xsistemo
Failed example:
    _to_xsistemo(u"ĈĉĜĝĤĥĴĵŜŝŬŭ")
Expected:
    'CxcxGxgxHxhxJxjxSxsxUxux'
Got:
   
"u'\\xc4\\x88\\xc4\\x89\\xc4\\x9c\\xc4\\x9d\\xc4\\xa4\\xc4\\xa5\\xc4\\xb4\\xc4\\xb5\\xc5\\x9c\\xc5\\x9d\\xc5\\xac\\xc5\\xad'"
**********************************************************************
1 items had failures:
   1 of   1 in __main__._to_xsistemo
***Test Failed*** 1 failures.
.
----------------------------------------------------------------------
Ran 1 test in 0.000s

OK


Thank you.
msg73894 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-09-26 21:48
You need to make your docstring a unicode string. Then both tests work
for me.
History
Date User Action Args
2022-04-11 14:56:39adminsetgithub: 48229
2008-09-26 21:48:33georg.brandlsetstatus: open -> closed
resolution: works for me
messages: + msg73894
nosy: + georg.brandl
2008-09-26 19:55:53pupenocreate