[Grok-dev] how to write doctest in unicode?

Brandon Craig Rhodes brandon at rhodesmill.org
Fri Aug 29 15:12:59 EDT 2008


I am attempting to write a doctest file by creating a .txt file and
putting ":Test-Layer: unit" up at the top, as outlined in:

   http://grok.zope.org/documentation/how-to/tests-with-grok-testing

But I cannot figure out how to make it Unicode-friendly; I am getting
mismatch reports like:

    - u'1¼ years'
    ?    ^^
    + u'1\xbc years'
    ?    ^^^^

Is there something like an ":Encoding: utf-8" that I can put at the top
of my doctest to get things working?  It actually looks like the doctest
is getting read in as Unicode, since the little number is showing up in
the "-" line that got read from the file, but the pretty Unicode output
is getting all mangled into a terrible escape code before getting
compared to the file.  Help! :-)

-- 
Brandon Craig Rhodes   brandon at rhodesmill.org   http://rhodesmill.org/brandon


More information about the Grok-dev mailing list