def _get_unicode_checker():
 if hasattr(_get_unicode_checker, 'UnicodeOutputChecker'):
  return _get_unicode_checker.UnicodeOutputChecker()
 import doctest
 import re
 class UnicodeOutputChecker(doctest.OutputChecker, ):
  '\n        Copied from doctest_nose_plugin.py from the nltk project:\n            https://github.com/nltk/nltk\n        '
  _literal_re = re.compile('(\\W|^)[uU]([rR]?[\\\'\\"])', re.UNICODE)
  def check_output(self, want, got, optionflags):
   res = doctest.OutputChecker.check_output(self, want, got, optionflags)
   if res:
    return True
   if (not (optionflags & _get_allow_unicode_flag())):
    return False
   else:
    def remove_u_prefixes(txt):
     return re.sub(self._literal_re, '\\1\\2', txt)
    want = remove_u_prefixes(want)
    got = remove_u_prefixes(got)
    res = doctest.OutputChecker.check_output(self, want, got, optionflags)
    return res
 _get_unicode_checker.UnicodeOutputChecker = UnicodeOutputChecker
 return _get_unicode_checker.UnicodeOutputChecker()

def _get_unicode_checker ( ) : if hasattr ( _get_unicode_checker , 'UnicodeOutputChecker' ) : return _get_unicode_checker . UnicodeOutputChecker ( ) import doctest import re class UnicodeOutputChecker ( doctest . OutputChecker , ) : _literal_re = re . compile ( '(\\W|^)[uU]([rR]?[\\\'\\"])' , re . UNICODE ) def check_output ( self , want , got , optionflags ) : res = doctest . OutputChecker . check_output ( self , want , got , optionflags ) if res : return True if ( not ( optionflags & _get_allow_unicode_flag ( ) ) ) : return False else : def remove_u_prefixes ( txt ) : return re . sub ( self . _literal_re , '\\1\\2' , txt ) want = remove_u_prefixes ( want ) got = remove_u_prefixes ( got ) res = doctest . OutputChecker . check_output ( self , want , got , optionflags ) return res _get_unicode_checker . UnicodeOutputChecker = UnicodeOutputChecker return _get_unicode_checker . UnicodeOutputChecker ( )
returns a doctest .