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.

Title: doctest unable to use '...' for unicode literals
Type: Stage:
Components: Library (Lib), Tests, Unicode Versions: Python 2.5
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: amaury.forgeotdarc, wysek
Priority: normal Keywords:

Created on 2008-07-29 09:24 by wysek, last changed 2022-04-11 14:56 by admin. This issue is now closed.

File name Uploaded Description Edit wysek, 2008-07-29 09:24 smallest possible test I created reprodusing the error
doctest_problem_output.txt wysek, 2008-07-29 10:30
Messages (4)
msg70382 - (view) Author: Piotr Wysocki (wysek) Date: 2008-07-29 09:24
Might be related to 2811
msg70383 - (view) Author: Piotr Wysocki (wysek) Date: 2008-07-29 09:27
As I would like to use '...' in order not to care about some part of a
unicode string containing unicode literals (using ELLIPSIS).
The unicode string is inside the value of a dict returned by a function.

It is working on Python 2.4.4 and not working on Python 2.5.2.
msg70384 - (view) Author: Piotr Wysocki (wysek) Date: 2008-07-29 10:30
I am attaching the output of on Python 2.5.2
in case it is necessary.

At the moment I haven't a clue where to look for a bug. Anybody? ;)
msg70386 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-07-29 11:19
This has nothing to do with doctest. Starting with your script, I get:

>>> a = f()
>>> b = repr(a)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character u'\u0105' in
position 4: ordinal not in range(128)

__repr__() is supposed to return a str object. In your case, I suggest
to use %r instead of "%s":
    def __repr__(self):
        return '<%s %r>' % (self.__class__.__name__, self.x)
Date User Action Args
2022-04-11 14:56:37adminsetgithub: 47715
2008-07-29 11:19:48amaury.forgeotdarcsetstatus: open -> closed
resolution: not a bug
messages: + msg70386
nosy: + amaury.forgeotdarc
2008-07-29 10:30:50wyseksetfiles: + doctest_problem_output.txt
messages: + msg70384
components: + Tests, Unicode
2008-07-29 09:27:21wyseksetmessages: + msg70383
2008-07-29 09:24:52wysekcreate