unicode in doctests

Bjorn Tillenius bjoti at home.se
Mon Nov 29 19:27:31 CET 2004


I'm trying to combine documentation and testing, by using DocFileSuite
from Python 2.4. But the problem is that I need to write non-ascii
characters in the test, and I can't get it to work. I haven't found a
way to specify which encoding the file is in, so it gets decoded to
unicode.

Anyone know if it's possible at all to use non-ascii character in a
DocFileSuite?

For example, this fails:

    >>> foo = u'föö'
    u'föö'

BTW, I know that I can use \-notation, but since the test will serve as
documentation as well, I don't want to use it.

Regards,

Bjorn



More information about the Python-list mailing list