I am writing my doctests like this:
>>> some_function(a=1, b=2)
{u\'id\': u\'123\', u\'name\': u\'abc\'}
This works fine for Pytho
I run into the same issue with doctests in NLTK; it was solved by using a custom doctest output checker (that treats u'foo' and 'foo' the same) which is installed by a custom nose plugin: https://github.com/nltk/nltk/blob/develop/nltk/test/doctest_nose_plugin.py
This solution is not pretty, but it works quite well (there are about 0.5 megabytes of doctests in NLTK) and it doesn't make doctests less readable.
EDIT: found a simplified standalone version of this nose plugin: https://github.com/gnublade/doctest-ignore-unicode