Source code for pychemia.test.doctest_2to3
import re
import sys
import doctest
[docs]class DocTestChecker(doctest.OutputChecker):
[docs] def check_output(self, want, got, optionflags):
if sys.version_info[0] > 2:
want = re.sub("u'(.*?)'", "'\\1'", want)
want = re.sub('u"(.*?)"', '"\\1"', want)
else:
want = re.sub("b'(.*?)'", "'\\1'", want)
want = re.sub('b"(.*?)"', '"\\1"', want)
return doctest.OutputChecker.check_output(self, want, got, optionflags)