PATH:
opt
/
bitninja-python-dojo
/
embedded
/
lib
/
python3.9
/
test
import codecs import html.entities import sys import unicodedata import unittest class PosReturn: # this can be used for configurable callbacks def __init__(self): self.pos = 0 def handle(self, exc): oldpos = self.pos realpos = oldpos if realpos<0: realpos = len(exc.object) + realpos # if we don't advance this time, terminate on the next call # otherwise we'd get an endless loop if realpos <= exc.start: self.pos = len(exc.object) return ("<?>", oldpos) # A UnicodeEncodeError object with a bad start attribute class BadStartUnicodeEncodeError(UnicodeEncodeError): def __init__(self): UnicodeEncodeError.__init__(self, "ascii", "", 0, 1, "bad") self.start = [] # A UnicodeEncodeError object with a bad object attribute class BadObjectUnicodeEncodeError(UnicodeEncodeError): def __init__(self): UnicodeEncodeError.__init__(self, "ascii", "", 0, 1, "bad") self.object = [] # A UnicodeDecodeError object without an end attribute class NoEndUnicodeDecodeError(UnicodeDecodeError): def __init__(self): UnicodeDecodeError.__init__(self, "ascii", bytearray(b""), 0, 1, "bad") del self.end # A UnicodeDecodeError object with a bad object attribute class BadObjectUnicodeDecodeError(UnicodeDecodeError): def __init__(self): UnicodeDecodeError.__init__(self, "ascii", bytearray(b""), 0, 1, "bad") self.object = [] # A UnicodeTranslateError object without a start attribute class NoStartUnicodeTranslateError(UnicodeTranslateError): def __init__(self): UnicodeTranslateError.__init__(self, "", 0, 1, "bad") del self.start # A UnicodeTranslateError object without an end attribute class NoEndUnicodeTranslateError(UnicodeTranslateError): def __init__(self): UnicodeTranslateError.__init__(self, "", 0, 1, "bad") del self.end # A UnicodeTranslateError object without an object attribute class NoObjectUnicodeTranslateError(UnicodeTranslateError): def __init__(self): UnicodeTranslateError.__init__(self, "", 0, 1, "bad") del self.object class CodecCallbackTest(unittest.TestCase): def test_xmlcharrefreplace(self): # replace unencodable characters which numeric character entities. # For ascii, latin-1 and charmaps this is completely implemented # in C and should be reasonably fast. s = "\u30b9\u30d1\u30e2 \xe4nd eggs" self.assertEqual( s.encode("ascii", "xmlcharrefreplace"), b"スパモ änd eggs" ) self.assertEqual( s.encode("latin-1", "xmlcharrefreplace"), b"スパモ \xe4nd eggs" ) def test_xmlcharnamereplace(self): # This time use a named character entity for unencodable # characters, if one is available. def xmlcharnamereplace(exc): if not isinstance(exc, UnicodeEncodeError): raise TypeError("don't know how to handle %r" % exc) l = [] for c in exc.object[exc.start:exc.end]: try: l.append("&%s;" % html.entities.codepoint2name[ord(c)]) except KeyError: l.append("&#%d;" % ord(c)) return ("".join(l), exc.end) codecs.register_error( "test.xmlcharnamereplace", xmlcharnamereplace) sin = "\xab\u211c\xbb = \u2329\u1234\u20ac\u232a" sout = b"«ℜ» = ⟨ሴ€⟩" self.assertEqual(sin.encode("ascii", "test.xmlcharnamereplace"), sout) sout = b"\xabℜ\xbb = ⟨ሴ€⟩" self.assertEqual(sin.encode("latin-1", "test.xmlcharnamereplace"), sout) sout = b"\xabℜ\xbb = ⟨ሴ\xa4⟩" self.assertEqual(sin.encode("iso-8859-15", "test.xmlcharnamereplace"), sout) def test_uninamereplace(self): # We're using the names from the unicode database this time, # and we're doing "syntax highlighting" here, i.e. we include # the replaced text in ANSI escape sequences. For this it is # useful that the error handler is not called for every single # unencodable character, but for a complete sequence of # unencodable characters, otherwise we would output many # unnecessary escape sequences. def uninamereplace(exc): if not isinstance(exc, UnicodeEncodeError): raise TypeError("don't know how to handle %r" % exc) l = [] for c in exc.object[exc.start:exc.end]: l.append(unicodedata.name(c, "0x%x" % ord(c))) return ("\033[1m%s\033[0m" % ", ".join(l), exc.end) codecs.register_error( "test.uninamereplace", uninamereplace) sin = "\xac\u1234\u20ac\u8000" sout = b"\033[1mNOT SIGN, ETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" self.assertEqual(sin.encode("ascii", "test.uninamereplace"), sout) sout = b"\xac\033[1mETHIOPIC SYLLABLE SEE, EURO SIGN, CJK UNIFIED IDEOGRAPH-8000\033[0m" self.assertEqual(sin.encode("latin-1", "test.uninamereplace"), sout) sout = b"\xac\033[1mETHIOPIC SYLLABLE SEE\033[0m\xa4\033[1mCJK UNIFIED IDEOGRAPH-8000\033[0m" self.assertEqual(sin.encode("iso-8859-15", "test.uninamereplace"), sout) def test_backslashescape(self): # Does the same as the "unicode-escape" encoding, but with different # base encodings. sin = "a\xac\u1234\u20ac\u8000\U0010ffff" sout = b"a\\xac\\u1234\\u20ac\\u8000\\U0010ffff" self.assertEqual(sin.encode("ascii", "backslashreplace"), sout) sout = b"a\xac\\u1234\\u20ac\\u8000\\U0010ffff" self.assertEqual(sin.encode("latin-1", "backslashreplace"), sout) sout = b"a\xac\\u1234\xa4\\u8000\\U0010ffff" self.assertEqual(sin.encode("iso-8859-15", "backslashreplace"), sout) def test_nameescape(self): # Does the same as backslashescape, but prefers ``\N{...}`` escape # sequences. sin = "a\xac\u1234\u20ac\u8000\U0010ffff" sout = (b'a\\N{NOT SIGN}\\N{ETHIOPIC SYLLABLE SEE}\\N{EURO SIGN}' b'\\N{CJK UNIFIED IDEOGRAPH-8000}\\U0010ffff') self.assertEqual(sin.encode("ascii", "namereplace"), sout) sout = (b'a\xac\\N{ETHIOPIC SYLLABLE SEE}\\N{EURO SIGN}' b'\\N{CJK UNIFIED IDEOGRAPH-8000}\\U0010ffff') self.assertEqual(sin.encode("latin-1", "namereplace"), sout) sout = (b'a\xac\\N{ETHIOPIC SYLLABLE SEE}\xa4' b'\\N{CJK UNIFIED IDEOGRAPH-8000}\\U0010ffff') self.assertEqual(sin.encode("iso-8859-15", "namereplace"), sout) def test_decoding_callbacks(self): # This is a test for a decoding callback handler # that allows the decoding of the invalid sequence # "\xc0\x80" and returns "\x00" instead of raising an error. # All other illegal sequences will be handled strictly. def relaxedutf8(exc): if not isinstance(exc, UnicodeDecodeError): raise TypeError("don't know how to handle %r" % exc) if exc.object[exc.start:exc.start+2] == b"\xc0\x80": return ("\x00", exc.start+2) # retry after two bytes else: raise exc codecs.register_error("test.relaxedutf8", relaxedutf8) # all the "\xc0\x80" will be decoded to "\x00" sin = b"a\x00b\xc0\x80c\xc3\xbc\xc0\x80\xc0\x80" sout = "a\x00b\x00c\xfc\x00\x00" self.assertEqual(sin.decode("utf-8", "test.relaxedutf8"), sout) # "\xc0\x81" is not valid and a UnicodeDecodeError will be raised sin = b"\xc0\x80\xc0\x81" self.assertRaises(UnicodeDecodeError, sin.decode, "utf-8", "test.relaxedutf8") def test_charmapencode(self): # For charmap encodings the replacement string will be # mapped through the encoding again. This means, that # to be able to use e.g. the "replace" handler, the # charmap has to have a mapping for "?". charmap = dict((ord(c), bytes(2*c.upper(), 'ascii')) for c in "abcdefgh") sin = "abc" sout = b"AABBCC" self.assertEqual(codecs.charmap_encode(sin, "strict", charmap)[0], sout) sin = "abcA" self.assertRaises(UnicodeError, codecs.charmap_encode, sin, "strict", charmap) charmap[ord("?")] = b"XYZ" sin = "abcDEF" sout = b"AABBCCXYZXYZXYZ" self.assertEqual(codecs.charmap_encode(sin, "replace", charmap)[0], sout) charmap[ord("?")] = "XYZ" # wrong type in mapping self.assertRaises(TypeError, codecs.charmap_encode, sin, "replace", charmap) def test_callbacks(self): def handler1(exc): r = range(exc.start, exc.end) if isinstance(exc, UnicodeEncodeError): l = ["<%d>" % ord(exc.object[pos]) for pos in r] elif isinstance(exc, UnicodeDecodeError): l = ["<%d>" % exc.object[pos] for pos in r] else: raise TypeError("don't know how to handle %r" % exc) return ("[%s]" % "".join(l), exc.end) codecs.register_error("test.handler1", handler1) def handler2(exc): if not isinstance(exc, UnicodeDecodeError): raise TypeError("don't know how to handle %r" % exc) l = ["<%d>" % exc.object[pos] for pos in range(exc.start, exc.end)] return ("[%s]" % "".join(l), exc.end+1) # skip one character codecs.register_error("test.handler2", handler2) s = b"\x00\x81\x7f\x80\xff" self.assertEqual( s.decode("ascii", "test.handler1"), "\x00[<129>]\x7f[<128>][<255>]" ) self.assertEqual( s.decode("ascii", "test.handler2"), "\x00[<129>][<128>]" ) self.assertEqual( b"\\u3042\\u3xxx".decode("unicode-escape", "test.handler1"), "\u3042[<92><117><51>]xxx" ) self.assertEqual( b"\\u3042\\u3xx".decode("unicode-escape", "test.handler1"), "\u3042[<92><117><51>]xx" ) self.assertEqual( codecs.charmap_decode(b"abc", "test.handler1", {ord("a"): "z"})[0], "z[<98>][<99>]" ) self.assertEqual( "g\xfc\xdfrk".encode("ascii", "test.handler1"), b"g[<252><223>]rk" ) self.assertEqual( "g\xfc\xdf".encode("ascii", "test.handler1"), b"g[<252><223>]" ) def test_longstrings(self): # test long strings to check for memory overflow problems errors = [ "strict", "ignore", "replace", "xmlcharrefreplace", "backslashreplace", "namereplace"] # register the handlers under different names, # to prevent the codec from recognizing the name for err in errors: codecs.register_error("test." + err, codecs.lookup_error(err)) l = 1000 errors += [ "test." + err for err in errors ] for uni in [ s*l for s in ("x", "\u3042", "a\xe4") ]: for enc in ("ascii", "latin-1", "iso-8859-1", "iso-8859-15", "utf-8", "utf-7", "utf-16", "utf-32"): for err in errors: try: uni.encode(enc, err) except UnicodeError: pass def check_exceptionobjectargs(self, exctype, args, msg): # Test UnicodeError subclasses: construction, attribute assignment and __str__ conversion # check with one missing argument self.assertRaises(TypeError, exctype, *args[:-1]) # check with one argument too much self.assertRaises(TypeError, exctype, *(args + ["too much"])) # check with one argument of the wrong type wrongargs = [ "spam", b"eggs", b"spam", 42, 1.0, None ] for i in range(len(args)): for wrongarg in wrongargs: if type(wrongarg) is type(args[i]): continue # build argument array callargs = [] for j in range(len(args)): if i==j: callargs.append(wrongarg) else: callargs.append(args[i]) self.assertRaises(TypeError, exctype, *callargs) # check with the correct number and type of arguments exc = exctype(*args) self.assertEqual(str(exc), msg) def test_unicodeencodeerror(self): self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", "g\xfcrk", 1, 2, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", "g\xfcrk", 1, 4, "ouch"], "'ascii' codec can't encode characters in position 1-3: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", "\xfcx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\xfc' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", "\u0100x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\u0100' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", "\uffffx", 0, 1, "ouch"], "'ascii' codec can't encode character '\\uffff' in position 0: ouch" ) self.check_exceptionobjectargs( UnicodeEncodeError, ["ascii", "\U00010000x", 0, 1, "ouch"], "'ascii' codec can't encode character '\\U00010000' in position 0: ouch" ) def test_unicodedecodeerror(self): self.check_exceptionobjectargs( UnicodeDecodeError, ["ascii", bytearray(b"g\xfcrk"), 1, 2, "ouch"], "'ascii' codec can't decode byte 0xfc in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeDecodeError, ["ascii", bytearray(b"g\xfcrk"), 1, 3, "ouch"], "'ascii' codec can't decode bytes in position 1-2: ouch" ) def test_unicodetranslateerror(self): self.check_exceptionobjectargs( UnicodeTranslateError, ["g\xfcrk", 1, 2, "ouch"], "can't translate character '\\xfc' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, ["g\u0100rk", 1, 2, "ouch"], "can't translate character '\\u0100' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, ["g\uffffrk", 1, 2, "ouch"], "can't translate character '\\uffff' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, ["g\U00010000rk", 1, 2, "ouch"], "can't translate character '\\U00010000' in position 1: ouch" ) self.check_exceptionobjectargs( UnicodeTranslateError, ["g\xfcrk", 1, 3, "ouch"], "can't translate characters in position 1-2: ouch" ) def test_badandgoodstrictexceptions(self): # "strict" complains about a non-exception passed in self.assertRaises( TypeError, codecs.strict_errors, 42 ) # "strict" complains about the wrong exception type self.assertRaises( Exception, codecs.strict_errors, Exception("ouch") ) # If the correct exception is passed in, "strict" raises it self.assertRaises( UnicodeEncodeError, codecs.strict_errors, UnicodeEncodeError("ascii", "\u3042", 0, 1, "ouch") ) self.assertRaises( UnicodeDecodeError, codecs.strict_errors, UnicodeDecodeError("ascii", bytearray(b"\xff"), 0, 1, "ouch") ) self.assertRaises( UnicodeTranslateError, codecs.strict_errors, UnicodeTranslateError("\u3042", 0, 1, "ouch") ) def test_badandgoodignoreexceptions(self): # "ignore" complains about a non-exception passed in self.assertRaises( TypeError, codecs.ignore_errors, 42 ) # "ignore" complains about the wrong exception type self.assertRaises( TypeError, codecs.ignore_errors, UnicodeError("ouch") ) # If the correct exception is passed in, "ignore" returns an empty replacement self.assertEqual( codecs.ignore_errors( UnicodeEncodeError("ascii", "a\u3042b", 1, 2, "ouch")), ("", 2) ) self.assertEqual( codecs.ignore_errors( UnicodeDecodeError("ascii", bytearray(b"a\xffb"), 1, 2, "ouch")), ("", 2) ) self.assertEqual( codecs.ignore_errors( UnicodeTranslateError("a\u3042b", 1, 2, "ouch")), ("", 2) ) def test_badandgoodreplaceexceptions(self): # "replace" complains about a non-exception passed in self.assertRaises( TypeError, codecs.replace_errors, 42 ) # "replace" complains about the wrong exception type self.assertRaises( TypeError, codecs.replace_errors, UnicodeError("ouch") ) self.assertRaises( TypeError, codecs.replace_errors, BadObjectUnicodeEncodeError() ) self.assertRaises( TypeError, codecs.replace_errors, BadObjectUnicodeDecodeError() ) # With the correct exception, "replace" returns an "?" or "\ufffd" replacement self.assertEqual( codecs.replace_errors( UnicodeEncodeError("ascii", "a\u3042b", 1, 2, "ouch")), ("?", 2) ) self.assertEqual( codecs.replace_errors( UnicodeDecodeError("ascii", bytearray(b"a\xffb"), 1, 2, "ouch")), ("\ufffd", 2) ) self.assertEqual( codecs.replace_errors( UnicodeTranslateError("a\u3042b", 1, 2, "ouch")), ("\ufffd", 2) ) def test_badandgoodxmlcharrefreplaceexceptions(self): # "xmlcharrefreplace" complains about a non-exception passed in self.assertRaises( TypeError, codecs.xmlcharrefreplace_errors, 42 ) # "xmlcharrefreplace" complains about the wrong exception types self.assertRaises( TypeError, codecs.xmlcharrefreplace_errors, UnicodeError("ouch") ) # "xmlcharrefreplace" can only be used for encoding self.assertRaises( TypeError, codecs.xmlcharrefreplace_errors, UnicodeDecodeError("ascii", bytearray(b"\xff"), 0, 1, "ouch") ) self.assertRaises( TypeError, codecs.xmlcharrefreplace_errors, UnicodeTranslateError("\u3042", 0, 1, "ouch") ) # Use the correct exception cs = (0, 1, 9, 10, 99, 100, 999, 1000, 9999, 10000, 99999, 100000, 999999, 1000000) cs += (0xd800, 0xdfff) s = "".join(chr(c) for c in cs) self.assertEqual( codecs.xmlcharrefreplace_errors( UnicodeEncodeError("ascii", "a" + s + "b", 1, 1 + len(s), "ouch") ), ("".join("&#%d;" % c for c in cs), 1 + len(s)) ) def test_badandgoodbackslashreplaceexceptions(self): # "backslashreplace" complains about a non-exception passed in self.assertRaises( TypeError, codecs.backslashreplace_errors, 42 ) # "backslashreplace" complains about the wrong exception types self.assertRaises( TypeError, codecs.backslashreplace_errors, UnicodeError("ouch") ) # Use the correct exception tests = [ ("\u3042", "\\u3042"), ("\n", "\\x0a"), ("a", "\\x61"), ("\x00", "\\x00"), ("\xff", "\\xff"), ("\u0100", "\\u0100"), ("\uffff", "\\uffff"), ("\U00010000", "\\U00010000"), ("\U0010ffff", "\\U0010ffff"), # Lone surrogates ("\ud800", "\\ud800"), ("\udfff", "\\udfff"), ("\ud800\udfff", "\\ud800\\udfff"), ] for s, r in tests: with self.subTest(str=s): self.assertEqual( codecs.backslashreplace_errors( UnicodeEncodeError("ascii", "a" + s + "b", 1, 1 + len(s), "ouch")), (r, 1 + len(s)) ) self.assertEqual( codecs.backslashreplace_errors( UnicodeTranslateError("a" + s + "b", 1, 1 + len(s), "ouch")), (r, 1 + len(s)) ) tests = [ (b"a", "\\x61"), (b"\n", "\\x0a"), (b"\x00", "\\x00"), (b"\xff", "\\xff"), ] for b, r in tests: with self.subTest(bytes=b): self.assertEqual( codecs.backslashreplace_errors( UnicodeDecodeError("ascii", bytearray(b"a" + b + b"b"), 1, 2, "ouch")), (r, 2) ) def test_badandgoodnamereplaceexceptions(self): # "namereplace" complains about a non-exception passed in self.assertRaises( TypeError, codecs.namereplace_errors, 42 ) # "namereplace" complains about the wrong exception types self.assertRaises( TypeError, codecs.namereplace_errors, UnicodeError("ouch") ) # "namereplace" can only be used for encoding self.assertRaises( TypeError, codecs.namereplace_errors, UnicodeDecodeError("ascii", bytearray(b"\xff"), 0, 1, "ouch") ) self.assertRaises( TypeError, codecs.namereplace_errors, UnicodeTranslateError("\u3042", 0, 1, "ouch") ) # Use the correct exception tests = [ ("\u3042", "\\N{HIRAGANA LETTER A}"), ("\x00", "\\x00"), ("\ufbf9", "\\N{ARABIC LIGATURE UIGHUR KIRGHIZ YEH WITH " "HAMZA ABOVE WITH ALEF MAKSURA ISOLATED FORM}"), ("\U000e007f", "\\N{CANCEL TAG}"), ("\U0010ffff", "\\U0010ffff"), # Lone surrogates ("\ud800", "\\ud800"), ("\udfff", "\\udfff"), ("\ud800\udfff", "\\ud800\\udfff"), ] for s, r in tests: with self.subTest(str=s): self.assertEqual( codecs.namereplace_errors( UnicodeEncodeError("ascii", "a" + s + "b", 1, 1 + len(s), "ouch")), (r, 1 + len(s)) ) def test_badandgoodsurrogateescapeexceptions(self): surrogateescape_errors = codecs.lookup_error('surrogateescape') # "surrogateescape" complains about a non-exception passed in self.assertRaises( TypeError, surrogateescape_errors, 42 ) # "surrogateescape" complains about the wrong exception types self.assertRaises( TypeError, surrogateescape_errors, UnicodeError("ouch") ) # "surrogateescape" can not be used for translating self.assertRaises( TypeError, surrogateescape_errors, UnicodeTranslateError("\udc80", 0, 1, "ouch") ) # Use the correct exception for s in ("a", "\udc7f", "\udd00"): with self.subTest(str=s): self.assertRaises( UnicodeEncodeError, surrogateescape_errors, UnicodeEncodeError("ascii", s, 0, 1, "ouch") ) self.assertEqual( surrogateescape_errors( UnicodeEncodeError("ascii", "a\udc80b", 1, 2, "ouch")), (b"\x80", 2) ) self.assertRaises( UnicodeDecodeError, surrogateescape_errors, UnicodeDecodeError("ascii", bytearray(b"a"), 0, 1, "ouch") ) self.assertEqual( surrogateescape_errors( UnicodeDecodeError("ascii", bytearray(b"a\x80b"), 1, 2, "ouch")), ("\udc80", 2) ) def test_badandgoodsurrogatepassexceptions(self): surrogatepass_errors = codecs.lookup_error('surrogatepass') # "surrogatepass" complains about a non-exception passed in self.assertRaises( TypeError, surrogatepass_errors, 42 ) # "surrogatepass" complains about the wrong exception types self.assertRaises( TypeError, surrogatepass_errors, UnicodeError("ouch") ) # "surrogatepass" can not be used for translating self.assertRaises( TypeError, surrogatepass_errors, UnicodeTranslateError("\ud800", 0, 1, "ouch") ) # Use the correct exception for enc in ("utf-8", "utf-16le", "utf-16be", "utf-32le", "utf-32be"): with self.subTest(encoding=enc): self.assertRaises( UnicodeEncodeError, surrogatepass_errors, UnicodeEncodeError(enc, "a", 0, 1, "ouch") ) self.assertRaises( UnicodeDecodeError, surrogatepass_errors, UnicodeDecodeError(enc, "a".encode(enc), 0, 1, "ouch") ) for s in ("\ud800", "\udfff", "\ud800\udfff"): with self.subTest(str=s): self.assertRaises( UnicodeEncodeError, surrogatepass_errors, UnicodeEncodeError("ascii", s, 0, len(s), "ouch") ) tests = [ ("utf-8", "\ud800", b'\xed\xa0\x80', 3), ("utf-16le", "\ud800", b'\x00\xd8', 2), ("utf-16be", "\ud800", b'\xd8\x00', 2), ("utf-32le", "\ud800", b'\x00\xd8\x00\x00', 4), ("utf-32be", "\ud800", b'\x00\x00\xd8\x00', 4), ("utf-8", "\udfff", b'\xed\xbf\xbf', 3), ("utf-16le", "\udfff", b'\xff\xdf', 2), ("utf-16be", "\udfff", b'\xdf\xff', 2), ("utf-32le", "\udfff", b'\xff\xdf\x00\x00', 4), ("utf-32be", "\udfff", b'\x00\x00\xdf\xff', 4), ("utf-8", "\ud800\udfff", b'\xed\xa0\x80\xed\xbf\xbf', 3), ("utf-16le", "\ud800\udfff", b'\x00\xd8\xff\xdf', 2), ("utf-16be", "\ud800\udfff", b'\xd8\x00\xdf\xff', 2), ("utf-32le", "\ud800\udfff", b'\x00\xd8\x00\x00\xff\xdf\x00\x00', 4), ("utf-32be", "\ud800\udfff", b'\x00\x00\xd8\x00\x00\x00\xdf\xff', 4), ] for enc, s, b, n in tests: with self.subTest(encoding=enc, str=s, bytes=b): self.assertEqual( surrogatepass_errors( UnicodeEncodeError(enc, "a" + s + "b", 1, 1 + len(s), "ouch")), (b, 1 + len(s)) ) self.assertEqual( surrogatepass_errors( UnicodeDecodeError(enc, bytearray(b"a" + b[:n] + b"b"), 1, 1 + n, "ouch")), (s[:1], 1 + n) ) def test_badhandlerresults(self): results = ( 42, "foo", (1,2,3), ("foo", 1, 3), ("foo", None), ("foo",), ("foo", 1, 3), ("foo", None), ("foo",) ) encs = ("ascii", "latin-1", "iso-8859-1", "iso-8859-15") for res in results: codecs.register_error("test.badhandler", lambda x: res) for enc in encs: self.assertRaises( TypeError, "\u3042".encode, enc, "test.badhandler" ) for (enc, bytes) in ( ("ascii", b"\xff"), ("utf-8", b"\xff"), ("utf-7", b"+x-"), ): self.assertRaises( TypeError, bytes.decode, enc, "test.badhandler" ) def test_lookup(self): self.assertEqual(codecs.strict_errors, codecs.lookup_error("strict")) self.assertEqual(codecs.ignore_errors, codecs.lookup_error("ignore")) self.assertEqual(codecs.strict_errors, codecs.lookup_error("strict")) self.assertEqual( codecs.xmlcharrefreplace_errors, codecs.lookup_error("xmlcharrefreplace") ) self.assertEqual( codecs.backslashreplace_errors, codecs.lookup_error("backslashreplace") ) self.assertEqual( codecs.namereplace_errors, codecs.lookup_error("namereplace") ) def test_unencodablereplacement(self): def unencrepl(exc): if isinstance(exc, UnicodeEncodeError): return ("\u4242", exc.end) else: raise TypeError("don't know how to handle %r" % exc) codecs.register_error("test.unencreplhandler", unencrepl) for enc in ("ascii", "iso-8859-1", "iso-8859-15"): self.assertRaises( UnicodeEncodeError, "\u4242".encode, enc, "test.unencreplhandler" ) def test_badregistercall(self): # enhance coverage of: # Modules/_codecsmodule.c::register_error() # Python/codecs.c::PyCodec_RegisterError() self.assertRaises(TypeError, codecs.register_error, 42) self.assertRaises(TypeError, codecs.register_error, "test.dummy", 42) def test_badlookupcall(self): # enhance coverage of: # Modules/_codecsmodule.c::lookup_error() self.assertRaises(TypeError, codecs.lookup_error) def test_unknownhandler(self): # enhance coverage of: # Modules/_codecsmodule.c::lookup_error() self.assertRaises(LookupError, codecs.lookup_error, "test.unknown") def test_xmlcharrefvalues(self): # enhance coverage of: # Python/codecs.c::PyCodec_XMLCharRefReplaceErrors() # and inline implementations v = (1, 5, 10, 50, 100, 500, 1000, 5000, 10000, 50000, 100000, 500000, 1000000) s = "".join([chr(x) for x in v]) codecs.register_error("test.xmlcharrefreplace", codecs.xmlcharrefreplace_errors) for enc in ("ascii", "iso-8859-15"): for err in ("xmlcharrefreplace", "test.xmlcharrefreplace"): s.encode(enc, err) def test_decodehelper(self): # enhance coverage of: # Objects/unicodeobject.c::unicode_decode_call_errorhandler() # and callers self.assertRaises(LookupError, b"\xff".decode, "ascii", "test.unknown") def baddecodereturn1(exc): return 42 codecs.register_error("test.baddecodereturn1", baddecodereturn1) self.assertRaises(TypeError, b"\xff".decode, "ascii", "test.baddecodereturn1") self.assertRaises(TypeError, b"\\".decode, "unicode-escape", "test.baddecodereturn1") self.assertRaises(TypeError, b"\\x0".decode, "unicode-escape", "test.baddecodereturn1") self.assertRaises(TypeError, b"\\x0y".decode, "unicode-escape", "test.baddecodereturn1") self.assertRaises(TypeError, b"\\Uffffeeee".decode, "unicode-escape", "test.baddecodereturn1") self.assertRaises(TypeError, b"\\uyyyy".decode, "raw-unicode-escape", "test.baddecodereturn1") def baddecodereturn2(exc): return ("?", None) codecs.register_error("test.baddecodereturn2", baddecodereturn2) self.assertRaises(TypeError, b"\xff".decode, "ascii", "test.baddecodereturn2") handler = PosReturn() codecs.register_error("test.posreturn", handler.handle) # Valid negative position handler.pos = -1 self.assertEqual(b"\xff0".decode("ascii", "test.posreturn"), "<?>0") # Valid negative position handler.pos = -2 self.assertEqual(b"\xff0".decode("ascii", "test.posreturn"), "<?><?>") # Negative position out of bounds handler.pos = -3 self.assertRaises(IndexError, b"\xff0".decode, "ascii", "test.posreturn") # Valid positive position handler.pos = 1 self.assertEqual(b"\xff0".decode("ascii", "test.posreturn"), "<?>0") # Largest valid positive position (one beyond end of input) handler.pos = 2 self.assertEqual(b"\xff0".decode("ascii", "test.posreturn"), "<?>") # Invalid positive position handler.pos = 3 self.assertRaises(IndexError, b"\xff0".decode, "ascii", "test.posreturn") # Restart at the "0" handler.pos = 6 self.assertEqual(b"\\uyyyy0".decode("raw-unicode-escape", "test.posreturn"), "<?>0") class D(dict): def __getitem__(self, key): raise ValueError self.assertRaises(UnicodeError, codecs.charmap_decode, b"\xff", "strict", {0xff: None}) self.assertRaises(ValueError, codecs.charmap_decode, b"\xff", "strict", D()) self.assertRaises(TypeError, codecs.charmap_decode, b"\xff", "strict", {0xff: sys.maxunicode+1}) def test_encodehelper(self): # enhance coverage of: # Objects/unicodeobject.c::unicode_encode_call_errorhandler() # and callers self.assertRaises(LookupError, "\xff".encode, "ascii", "test.unknown") def badencodereturn1(exc): return 42 codecs.register_error("test.badencodereturn1", badencodereturn1) self.assertRaises(TypeError, "\xff".encode, "ascii", "test.badencodereturn1") def badencodereturn2(exc): return ("?", None) codecs.register_error("test.badencodereturn2", badencodereturn2) self.assertRaises(TypeError, "\xff".encode, "ascii", "test.badencodereturn2") handler = PosReturn() codecs.register_error("test.posreturn", handler.handle) # Valid negative position handler.pos = -1 self.assertEqual("\xff0".encode("ascii", "test.posreturn"), b"<?>0") # Valid negative position handler.pos = -2 self.assertEqual("\xff0".encode("ascii", "test.posreturn"), b"<?><?>") # Negative position out of bounds handler.pos = -3 self.assertRaises(IndexError, "\xff0".encode, "ascii", "test.posreturn") # Valid positive position handler.pos = 1 self.assertEqual("\xff0".encode("ascii", "test.posreturn"), b"<?>0") # Largest valid positive position (one beyond end of input handler.pos = 2 self.assertEqual("\xff0".encode("ascii", "test.posreturn"), b"<?>") # Invalid positive position handler.pos = 3 self.assertRaises(IndexError, "\xff0".encode, "ascii", "test.posreturn") handler.pos = 0 class D(dict): def __getitem__(self, key): raise ValueError for err in ("strict", "replace", "xmlcharrefreplace", "backslashreplace", "namereplace", "test.posreturn"): self.assertRaises(UnicodeError, codecs.charmap_encode, "\xff", err, {0xff: None}) self.assertRaises(ValueError, codecs.charmap_encode, "\xff", err, D()) self.assertRaises(TypeError, codecs.charmap_encode, "\xff", err, {0xff: 300}) def test_translatehelper(self): # enhance coverage of: # Objects/unicodeobject.c::unicode_encode_call_errorhandler() # and callers # (Unfortunately the errors argument is not directly accessible # from Python, so we can't test that much) class D(dict): def __getitem__(self, key): raise ValueError #self.assertRaises(ValueError, "\xff".translate, D()) self.assertRaises(ValueError, "\xff".translate, {0xff: sys.maxunicode+1}) self.assertRaises(TypeError, "\xff".translate, {0xff: ()}) def test_bug828737(self): charmap = { ord("&"): "&", ord("<"): "<", ord(">"): ">", ord('"'): """, } for n in (1, 10, 100, 1000): text = 'abc<def>ghi'*n text.translate(charmap) def test_mutatingdecodehandler(self): baddata = [ ("ascii", b"\xff"), ("utf-7", b"++"), ("utf-8", b"\xff"), ("utf-16", b"\xff"), ("utf-32", b"\xff"), ("unicode-escape", b"\\u123g"), ("raw-unicode-escape", b"\\u123g"), ] def replacing(exc): if isinstance(exc, UnicodeDecodeError): exc.object = 42 return ("\u4242", 0) else: raise TypeError("don't know how to handle %r" % exc) codecs.register_error("test.replacing", replacing) for (encoding, data) in baddata: with self.assertRaises(TypeError): data.decode(encoding, "test.replacing") def mutating(exc): if isinstance(exc, UnicodeDecodeError): exc.object = b"" return ("\u4242", 0) else: raise TypeError("don't know how to handle %r" % exc) codecs.register_error("test.mutating", mutating) # If the decoder doesn't pick up the modified input the following # will lead to an endless loop for (encoding, data) in baddata: self.assertEqual(data.decode(encoding, "test.mutating"), "\u4242") # issue32583 def test_crashing_decode_handler(self): # better generating one more character to fill the extra space slot # so in debug build it can steadily fail def forward_shorter_than_end(exc): if isinstance(exc, UnicodeDecodeError): # size one character, 0 < forward < exc.end return ('\ufffd', exc.start+1) else: raise TypeError("don't know how to handle %r" % exc) codecs.register_error( "test.forward_shorter_than_end", forward_shorter_than_end) self.assertEqual( b'\xd8\xd8\xd8\xd8\xd8\x00\x00\x00'.decode( 'utf-16-le', 'test.forward_shorter_than_end'), '\ufffd\ufffd\ufffd\ufffd\xd8\x00' ) self.assertEqual( b'\xd8\xd8\xd8\xd8\x00\xd8\x00\x00'.decode( 'utf-16-be', 'test.forward_shorter_than_end'), '\ufffd\ufffd\ufffd\ufffd\xd8\x00' ) self.assertEqual( b'\x11\x11\x11\x11\x11\x00\x00\x00\x00\x00\x00'.decode( 'utf-32-le', 'test.forward_shorter_than_end'), '\ufffd\ufffd\ufffd\u1111\x00' ) self.assertEqual( b'\x11\x11\x11\x00\x00\x11\x11\x00\x00\x00\x00'.decode( 'utf-32-be', 'test.forward_shorter_than_end'), '\ufffd\ufffd\ufffd\u1111\x00' ) def replace_with_long(exc): if isinstance(exc, UnicodeDecodeError): exc.object = b"\x00" * 8 return ('\ufffd', exc.start) else: raise TypeError("don't know how to handle %r" % exc) codecs.register_error("test.replace_with_long", replace_with_long) self.assertEqual( b'\x00'.decode('utf-16', 'test.replace_with_long'), '\ufffd\x00\x00\x00\x00' ) self.assertEqual( b'\x00'.decode('utf-32', 'test.replace_with_long'), '\ufffd\x00\x00' ) def test_fake_error_class(self): handlers = [ codecs.strict_errors, codecs.ignore_errors, codecs.replace_errors, codecs.backslashreplace_errors, codecs.namereplace_errors, codecs.xmlcharrefreplace_errors, codecs.lookup_error('surrogateescape'), codecs.lookup_error('surrogatepass'), ] for cls in UnicodeEncodeError, UnicodeDecodeError, UnicodeTranslateError: class FakeUnicodeError(str): __class__ = cls for handler in handlers: with self.subTest(handler=handler, error_class=cls): self.assertRaises(TypeError, handler, FakeUnicodeError()) class FakeUnicodeError(Exception): __class__ = cls for handler in handlers: with self.subTest(handler=handler, error_class=cls): with self.assertRaises((TypeError, FakeUnicodeError)): handler(FakeUnicodeError()) if __name__ == "__main__": unittest.main()
[+]
..
[-] test_largefile.py
[edit]
[-] test_set.py
[edit]
[-] test_sunau.py
[edit]
[-] test_webbrowser.py
[edit]
[-] test_idle.py
[edit]
[-] keycert.passwd.pem
[edit]
[-] bisect_cmd.py
[edit]
[-] talos-2019-0758.pem
[edit]
[-] audiotest.au
[edit]
[-] test_selectors.py
[edit]
[-] test_pydoc.py
[edit]
[-] test_uu.py
[edit]
[-] ssltests.py
[edit]
[-] test_heapq.py
[edit]
[-] test_parser.py
[edit]
[-] test_bufio.py
[edit]
[-] test_ucn.py
[edit]
[-] sample_doctest_no_doctests.py
[edit]
[-] Sine-1000Hz-300ms.aif
[edit]
[-] test_pkg.py
[edit]
[+]
support
[-] profilee.py
[edit]
[-] test_codecencodings_hk.py
[edit]
[-] pydocfodder.py
[edit]
[-] test_graphlib.py
[edit]
[-] test_raise.py
[edit]
[-] test_genericalias.py
[edit]
[-] curses_tests.py
[edit]
[-] _typed_dict_helper.py
[edit]
[-] test_doctest2.txt
[edit]
[-] test_zipfile.py
[edit]
[-] test_imghdr.py
[edit]
[-] test_type_comments.py
[edit]
[-] bad_getattr.py
[edit]
[-] test_asyncore.py
[edit]
[-] test_script_helper.py
[edit]
[+]
sndhdrdata
[-] test_ossaudiodev.py
[edit]
[-] formatfloat_testcases.txt
[edit]
[-] test_grammar.py
[edit]
[-] test_unicodedata.py
[edit]
[-] test_re.py
[edit]
[-] test_pkgutil.py
[edit]
[-] test_nis.py
[edit]
[-] test__xxsubinterpreters.py
[edit]
[-] nullbytecert.pem
[edit]
[-] pydoc_mod.py
[edit]
[-] test_winconsoleio.py
[edit]
[-] test_abstract_numbers.py
[edit]
[-] test_glob.py
[edit]
[-] test_runpy.py
[edit]
[+]
data
[-] test__opcode.py
[edit]
[+]
cjkencodings
[-] test_descr.py
[edit]
[-] test_codecmaps_hk.py
[edit]
[-] test_future3.py
[edit]
[-] test_regrtest.py
[edit]
[-] test_c_locale_coercion.py
[edit]
[-] test_doctest4.txt
[edit]
[-] test_dis.py
[edit]
[-] test_xml_etree.py
[edit]
[-] ann_module5.py
[edit]
[-] test_sundry.py
[edit]
[-] test_pstats.py
[edit]
[-] test_socketserver.py
[edit]
[-] test_codeop.py
[edit]
[-] test_genericpath.py
[edit]
[-] test_complex.py
[edit]
[-] test_grp.py
[edit]
[-] test_extcall.py
[edit]
[-] test_sys_setprofile.py
[edit]
[-] test_threading.py
[edit]
[-] test_subclassinit.py
[edit]
[-] gdb_sample.py
[edit]
[-] test_wsgiref.py
[edit]
[-] test_fstring.py
[edit]
[-] allsans.pem
[edit]
[-] inspect_fodder2.py
[edit]
[-] dataclass_module_2_str.py
[edit]
[-] test_unary.py
[edit]
[-] test_doctest.py
[edit]
[-] badsyntax_future8.py
[edit]
[-] test_decorators.py
[edit]
[-] _test_multiprocessing.py
[edit]
[-] ieee754.txt
[edit]
[-] badsyntax_future4.py
[edit]
[-] test_property.py
[edit]
[-] test_symbol.py
[edit]
[-] test_rlcompleter.py
[edit]
[-] test_sort.py
[edit]
[-] test_codecencodings_cn.py
[edit]
[-] test_traceback.py
[edit]
[-] test_xmlrpc.py
[edit]
[+]
test_peg_generator
[-] test_posixpath.py
[edit]
[-] test_future5.py
[edit]
[-] test_textwrap.py
[edit]
[-] mapping_tests.py
[edit]
[-] test_gzip.py
[edit]
[-] floating_points.txt
[edit]
[-] test_httpservers.py
[edit]
[-] test_array.py
[edit]
[-] test_structmembers.py
[edit]
[-] test_pwd.py
[edit]
[-] test_calendar.py
[edit]
[-] test_dynamicclassattribute.py
[edit]
[+]
test_tools
[-] dataclass_module_2.py
[edit]
[-] test_codecencodings_kr.py
[edit]
[-] mp_fork_bomb.py
[edit]
[-] ssl_key.pem
[edit]
[-] test_bz2.py
[edit]
[-] test_codeccallbacks.py
[edit]
[-] test_deque.py
[edit]
[-] test_peepholer.py
[edit]
[-] test_multiprocessing_forkserver.py
[edit]
[-] test_unittest.py
[edit]
[-] test_asynchat.py
[edit]
[-] test_struct.py
[edit]
[-] test_osx_env.py
[edit]
[-] test_slice.py
[edit]
[-] test_finalization.py
[edit]
[-] test_pipes.py
[edit]
[-] test_multiprocessing_main_handling.py
[edit]
[-] test_unicode_identifiers.py
[edit]
[-] test_userlist.py
[edit]
[-] datetimetester.py
[edit]
[-] test_fork1.py
[edit]
[-] test_shelve.py
[edit]
[-] test_fcntl.py
[edit]
[-] test_errno.py
[edit]
[-] test_tempfile.py
[edit]
[-] make_ssl_certs.py
[edit]
[-] randv2_64.pck
[edit]
[-] string_tests.py
[edit]
[-] future_test1.py
[edit]
[-] test_pathlib.py
[edit]
[-] nullcert.pem
[edit]
[-] test_wait4.py
[edit]
[-] test_cmd.py
[edit]
[-] test_memoryview.py
[edit]
[+]
audiodata
[-] test_modulefinder.py
[edit]
[-] test_optparse.py
[edit]
[+]
libregrtest
[-] test_bigaddrspace.py
[edit]
[-] test_module.py
[edit]
[-] test_structseq.py
[edit]
[-] test_unicode.py
[edit]
[-] test_positional_only_arg.py
[edit]
[-] test_wave.py
[edit]
[-] test_popen.py
[edit]
[-] test_multiprocessing_fork.py
[edit]
[-] test_context.py
[edit]
[+]
test_email
[-] test_typechecks.py
[edit]
[-] mp_preload.py
[edit]
[-] win_console_handler.py
[edit]
[-] test_capi.py
[edit]
[-] multibytecodec_support.py
[edit]
[-] test_lib2to3.py
[edit]
[-] test_copyreg.py
[edit]
[-] test_operator.py
[edit]
[-] test_urllib.py
[edit]
[-] test_resource.py
[edit]
[-] keycert.pem
[edit]
[-] test_ioctl.py
[edit]
[-] test_getopt.py
[edit]
[+]
eintrdata
[-] badsyntax_future3.py
[edit]
[-] test_buffer.py
[edit]
[-] test_math.py
[edit]
[-] test_thread.py
[edit]
[-] keycert3.pem
[edit]
[-] test_configparser.py
[edit]
[-] test_float.py
[edit]
[-] test_pprint.py
[edit]
[-] test_long.py
[edit]
[-] test_netrc.py
[edit]
[-] test_concurrent_futures.py
[edit]
[-] mime.types
[edit]
[-] memory_watchdog.py
[edit]
[-] test_compare.py
[edit]
[-] test_future.py
[edit]
[-] ann_module.py
[edit]
[-] signalinterproctester.py
[edit]
[-] badsyntax_future9.py
[edit]
[-] test_baseexception.py
[edit]
[-] test_timeout.py
[edit]
[-] lock_tests.py
[edit]
[-] test_urllib2net.py
[edit]
[-] math_testcases.txt
[edit]
[-] test_listcomps.py
[edit]
[-] test_filecmp.py
[edit]
[-] test_unpack_ex.py
[edit]
[-] test_sys.py
[edit]
[-] test_bytes.py
[edit]
[-] selfsigned_pythontestdotnet.pem
[edit]
[-] keycert2.pem
[edit]
[-] test_file_eintr.py
[edit]
[-] exception_hierarchy.txt
[edit]
[-] test_decimal.py
[edit]
[-] test_spwd.py
[edit]
[-] test_aifc.py
[edit]
[-] reperf.py
[edit]
[-] test_userstring.py
[edit]
[-] test_ordered_dict.py
[edit]
[-] ann_module3.py
[edit]
[-] test_threading_local.py
[edit]
[-] test_pdb.py
[edit]
[-] test_smtpnet.py
[edit]
[-] recursion.tar
[edit]
[-] test_zipimport_support.py
[edit]
[+]
test_warnings
[-] test_richcmp.py
[edit]
[-] test_mailcap.py
[edit]
[-] test_linecache.py
[edit]
[-] test_weakref.py
[edit]
[-] test_iter.py
[edit]
[-] test_copy.py
[edit]
[-] test_scope.py
[edit]
[-] __main__.py
[edit]
[-] test_crypt.py
[edit]
[-] test_clinic.py
[edit]
[-] tokenize_tests-utf8-coding-cookie-and-utf8-bom-sig.txt
[edit]
[-] test_gdb.py
[edit]
[-] test_audioop.py
[edit]
[-] empty.vbs
[edit]
[-] test_with.py
[edit]
[-] inspect_fodder.py
[edit]
[-] test_iterlen.py
[edit]
[-] seq_tests.py
[edit]
[-] test_colorsys.py
[edit]
[-] test_openpty.py
[edit]
[-] test_opcodes.py
[edit]
[-] test_sysconfig.py
[edit]
[-] test_quopri.py
[edit]
[-] test_smtpd.py
[edit]
[-] idnsans.pem
[edit]
[-] test_site.py
[edit]
[-] test_strptime.py
[edit]
[-] test_code.py
[edit]
[-] mock_socket.py
[edit]
[-] test_genexps.py
[edit]
[-] badsyntax_future10.py
[edit]
[-] tokenize_tests-no-coding-cookie-and-utf8-bom-sig-only.txt
[edit]
[-] test_epoll.py
[edit]
[-] test_itertools.py
[edit]
[-] test_cprofile.py
[edit]
[-] test_uuid.py
[edit]
[-] test_lltrace.py
[edit]
[-] test_zipfile64.py
[edit]
[-] test_tcl.py
[edit]
[-] test_cgitb.py
[edit]
[-] test_datetime.py
[edit]
[-] test_doctest3.txt
[edit]
[-] test_pulldom.py
[edit]
[+]
ziptestdata
[-] future_test2.py
[edit]
[-] test_winreg.py
[edit]
[-] test_atexit.py
[edit]
[-] test_ttk_textonly.py
[edit]
[-] test_bigmem.py
[edit]
[-] ffdh3072.pem
[edit]
[-] test_charmapcodec.py
[edit]
[-] test_utf8_mode.py
[edit]
[-] test_zipimport.py
[edit]
[-] test_html.py
[edit]
[-] test_robotparser.py
[edit]
[-] test_types.py
[edit]
[-] test_codecencodings_iso2022.py
[edit]
[-] test_bisect.py
[edit]
[-] test_class.py
[edit]
[-] test_dictviews.py
[edit]
[-] test_mailbox.py
[edit]
[-] test_httplib.py
[edit]
[-] test_bool.py
[edit]
[-] test_tarfile.py
[edit]
[-] test_io.py
[edit]
[-] test_enum.py
[edit]
[-] test_fileio.py
[edit]
[-] badsyntax_3131.py
[edit]
[-] test_asdl_parser.py
[edit]
[-] keycertecc.pem
[edit]
[-] test_code_module.py
[edit]
[-] test_descrtut.py
[edit]
[-] autotest.py
[edit]
[-] test_poplib.py
[edit]
[-] test_compileall.py
[edit]
[-] test_frame.py
[edit]
[-] list_tests.py
[edit]
[+]
test_zoneinfo
[-] coding20731.py
[edit]
[-] test_imp.py
[edit]
[+]
test_asyncio
[-] test_pyexpat.py
[edit]
[-] test_pickle.py
[edit]
[-] randv3.pck
[edit]
[-] bad_coding2.py
[edit]
[-] test__osx_support.py
[edit]
[-] test_setcomps.py
[edit]
[-] fork_wait.py
[edit]
[-] test_posix.py
[edit]
[-] test_enumerate.py
[edit]
[-] test_eof.py
[edit]
[+]
__pycache__
[-] tokenize_tests-utf8-coding-cookie-and-no-utf8-bom-sig.txt
[edit]
[-] pythoninfo.py
[edit]
[-] pickletester.py
[edit]
[-] time_hashlib.py
[edit]
[-] test_shlex.py
[edit]
[-] test_dict_version.py
[edit]
[-] test_statistics.py
[edit]
[-] test_ntpath.py
[edit]
[-] test_mmap.py
[edit]
[-] test_difflib.py
[edit]
[-] tokenize_tests-latin1-coding-cookie-and-utf8-bom-sig.txt
[edit]
[-] test_curses.py
[edit]
[-] test_codecencodings_jp.py
[edit]
[-] test_tix.py
[edit]
[-] test_timeit.py
[edit]
[-] test_memoryio.py
[edit]
[-] test_ftplib.py
[edit]
[-] test_gettext.py
[edit]
[-] clinic.test
[edit]
[-] test_distutils.py
[edit]
[-] test_support.py
[edit]
[-] test_augassign.py
[edit]
[-] test_imaplib.py
[edit]
[-] test_sndhdr.py
[edit]
[-] mailcap.txt
[edit]
[-] test_cmath.py
[edit]
[-] test_urllib_response.py
[edit]
[-] ssl_key.passwd.pem
[edit]
[-] test_tokenize.py
[edit]
[-] test_format.py
[edit]
[-] test_dynamic.py
[edit]
[-] test_global.py
[edit]
[-] test_os.py
[edit]
[-] badcert.pem
[edit]
[-] test_secrets.py
[edit]
[-] test_pyclbr.py
[edit]
[-] test_picklebuffer.py
[edit]
[-] badkey.pem
[edit]
[-] test_dbm.py
[edit]
[-] test_nntplib.py
[edit]
[-] test_flufl.py
[edit]
[-] test_eintr.py
[edit]
[-] test_multiprocessing_spawn.py
[edit]
[-] test_xmlrpc_net.py
[edit]
[-] tf_inherit_check.py
[edit]
[-] nokia.pem
[edit]
[-] test_audit.py
[edit]
[-] final_b.py
[edit]
[-] tokenize_tests.txt
[edit]
[-] revocation.crl
[edit]
[+]
subprocessdata
[-] test_codecmaps_tw.py
[edit]
[-] test_file.py
[edit]
[-] cmath_testcases.txt
[edit]
[-] test_signal.py
[edit]
[-] test_codecmaps_jp.py
[edit]
[-] test_int.py
[edit]
[-] test_sqlite.py
[edit]
[-] test_http_cookies.py
[edit]
[-] sgml_input.html
[edit]
[-] badsyntax_future5.py
[edit]
[-] test_unicode_file_functions.py
[edit]
[-] re_tests.py
[edit]
[-] mod_generics_cache.py
[edit]
[-] test_repl.py
[edit]
[-] test_faulthandler.py
[edit]
[-] test_telnetlib.py
[edit]
[-] test_exceptions.py
[edit]
[-] test_builtin.py
[edit]
[-] test_frozen.py
[edit]
[-] sortperf.py
[edit]
[-] test_named_expressions.py
[edit]
[-] test_codecs.py
[edit]
[-] test_zipapp.py
[edit]
[-] test_dictcomps.py
[edit]
[-] test___future__.py
[edit]
[+]
dtracedata
[-] dataclass_module_1.py
[edit]
[-] test_binascii.py
[edit]
[-] test___all__.py
[edit]
[-] testtar.tar
[edit]
[+]
test_json
[-] secp384r1.pem
[edit]
[-] test_locale.py
[edit]
[-] cfgparser.2
[edit]
[-] test_trace.py
[edit]
[-] test_binop.py
[edit]
[-] test_threadsignals.py
[edit]
[-] test_fractions.py
[edit]
[-] test_univnewlines.py
[edit]
[-] test_argparse.py
[edit]
[-] zipdir.zip
[edit]
[-] test_marshal.py
[edit]
[-] test_strtod.py
[edit]
[-] test_hmac.py
[edit]
[-] test_random.py
[edit]
[-] test_urllib2.py
[edit]
[-] test_syntax.py
[edit]
[-] test_compile.py
[edit]
[-] xmltests.py
[edit]
[-] test_tracemalloc.py
[edit]
[-] final_a.py
[edit]
[-] test_functools.py
[edit]
[+]
capath
[-] pyclbr_input.py
[edit]
[-] test_yield_from.py
[edit]
[-] badsyntax_future6.py
[edit]
[-] test_xml_dom_minicompat.py
[edit]
[-] test_bdb.py
[edit]
[-] test_ast.py
[edit]
[-] test_ensurepip.py
[edit]
[-] test_threadedtempfile.py
[edit]
[-] test_keyword.py
[edit]
[-] test_strftime.py
[edit]
[-] test_logging.py
[edit]
[+]
decimaltestdata
[-] test_dataclasses.py
[edit]
[-] test_lzma.py
[edit]
[-] test_startfile.py
[edit]
[-] test_venv.py
[edit]
[-] test_zlib.py
[edit]
[-] test_contains.py
[edit]
[-] test_docxmlrpc.py
[edit]
[-] test_stringprep.py
[edit]
[-] test_defaultdict.py
[edit]
[-] audiotests.py
[edit]
[-] test_ctypes.py
[edit]
[-] imp_dummy.py
[edit]
[-] relimport.py
[edit]
[-] test_codecencodings_tw.py
[edit]
[-] test_genericclass.py
[edit]
[-] cfgparser.3
[edit]
[-] dis_module.py
[edit]
[-] test_cgi.py
[edit]
[-] pycakey.pem
[edit]
[-] test_xxtestfuzz.py
[edit]
[-] test_winsound.py
[edit]
[-] test_unicode_file.py
[edit]
[-] test_msilib.py
[edit]
[-] __init__.py
[edit]
[-] pycacert.pem
[edit]
[-] test_dbm_ndbm.py
[edit]
[+]
tracedmodules
[-] test_cmd_line.py
[edit]
[-] good_getattr.py
[edit]
[+]
imghdrdata
[-] test_kqueue.py
[edit]
[-] test_call.py
[edit]
[-] bad_getattr3.py
[edit]
[-] test_abc.py
[edit]
[-] test_xdrlib.py
[edit]
[-] test_generator_stop.py
[edit]
[-] test_hash.py
[edit]
[-] test_urlparse.py
[edit]
[-] test_sax.py
[edit]
[-] test_dict.py
[edit]
[-] test_reprlib.py
[edit]
[-] pstats.pck
[edit]
[-] test_list.py
[edit]
[-] ann_module6.py
[edit]
[-] test_utf8source.py
[edit]
[-] test_symtable.py
[edit]
[-] test_ttk_guionly.py
[edit]
[-] test_cmd_line_script.py
[edit]
[-] doctest_aliases.py
[edit]
[-] test_http_cookiejar.py
[edit]
[-] test_turtle.py
[edit]
[-] keycert4.pem
[edit]
[-] ann_module2.py
[edit]
[-] test_py_compile.py
[edit]
[-] test_super.py
[edit]
[+]
test_import
[-] test_binhex.py
[edit]
[-] test_coroutines.py
[edit]
[-] test_contextlib_async.py
[edit]
[+]
encoded_modules
[-] test_ipaddress.py
[edit]
[-] test_platform.py
[edit]
[-] test_longexp.py
[edit]
[-] test_codecmaps_cn.py
[edit]
[-] test_unpack.py
[edit]
[-] test_doctest.txt
[edit]
[-] test_socket.py
[edit]
[-] test_difflib_expect.html
[edit]
[-] test_check_c_globals.py
[edit]
[-] test_sys_settrace.py
[edit]
[-] test_urllib2_localnet.py
[edit]
[+]
xmltestdata
[-] test_dtrace.py
[edit]
[-] sample_doctest.py
[edit]
[-] sample_doctest_no_docstrings.py
[edit]
[-] test_csv.py
[edit]
[-] testcodec.py
[edit]
[-] badsyntax_future7.py
[edit]
[-] test_htmlparser.py
[edit]
[-] bad_coding.py
[edit]
[-] zip_cp437_header.zip
[edit]
[-] test_tabnanny.py
[edit]
[-] double_const.py
[edit]
[-] test_urllibnet.py
[edit]
[-] test_asyncgen.py
[edit]
[-] test_time.py
[edit]
[-] test_pow.py
[edit]
[-] test_tk.py
[edit]
[-] test_profile.py
[edit]
[-] test_smtplib.py
[edit]
[-] test_stat.py
[edit]
[-] test_generators.py
[edit]
[-] test_isinstance.py
[edit]
[-] test_index.py
[edit]
[-] test_int_literal.py
[edit]
[-] test_string.py
[edit]
[-] test_keywordonlyarg.py
[edit]
[-] test_fileinput.py
[edit]
[-] test_weakset.py
[edit]
[-] ssl_servers.py
[edit]
[-] test_sched.py
[edit]
[-] test_queue.py
[edit]
[-] test_unparse.py
[edit]
[-] test_typing.py
[edit]
[-] test_poll.py
[edit]
[-] test_mimetypes.py
[edit]
[-] test_xml_etree_c.py
[edit]
[-] test__locale.py
[edit]
[-] cfgparser.1
[edit]
[-] test_select.py
[edit]
[-] test_ssl.py
[edit]
[-] test_print.py
[edit]
[-] test_minidom.py
[edit]
[-] test_contextlib.py
[edit]
[-] test_exception_variations.py
[edit]
[-] bad_getattr2.py
[edit]
[-] test_shutil.py
[edit]
[-] test_devpoll.py
[edit]
[-] test_doctest2.py
[edit]
[-] test_source_encoding.py
[edit]
[-] audit-tests.py
[edit]
[-] test_getpass.py
[edit]
[-] test_fnmatch.py
[edit]
[-] test_plistlib.py
[edit]
[-] test_crashers.py
[edit]
[-] test_future4.py
[edit]
[-] test_getargs2.py
[edit]
[-] test_gc.py
[edit]
[-] badsyntax_pep3120.py
[edit]
[-] test_userdict.py
[edit]
[-] dataclass_module_1_str.py
[edit]
[-] test_inspect.py
[edit]
[-] test_codecmaps_kr.py
[edit]
[-] test_tuple.py
[edit]
[-] test_readline.py
[edit]
[-] dataclass_textanno.py
[edit]
[-] test_dbm_dumb.py
[edit]
[+]
test_importlib
[-] test_hashlib.py
[edit]
[-] test_syslog.py
[edit]
[-] test_pty.py
[edit]
[-] test_pickletools.py
[edit]
[-] regrtest.py
[edit]
[-] test_wait3.py
[edit]
[-] test_collections.py
[edit]
[-] test_peg_parser.py
[edit]
[-] test_string_literals.py
[edit]
[-] test_multibytecodec.py
[edit]
[-] test_range.py
[edit]
[-] test_exception_hierarchy.py
[edit]
[-] randv2_32.pck
[edit]
[-] nosan.pem
[edit]
[-] test_metaclass.py
[edit]
[-] test_numeric_tower.py
[edit]
[-] test_subprocess.py
[edit]
[-] test_embed.py
[edit]
[-] ssl_cert.pem
[edit]
[-] test_dbm_gnu.py
[edit]
[-] test_base64.py
[edit]
[-] test_funcattrs.py
[edit]