MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_longstrings

Method test_longstrings

Lib/test/test_codeccallbacks.py:284–301  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

282 )
283
284 def test_longstrings(self):
285 # test long strings to check for memory overflow problems
286 errors = [ "strict", "ignore", "replace", "xmlcharrefreplace",
287 "backslashreplace", "namereplace"]
288 # register the handlers under different names,
289 # to prevent the codec from recognizing the name
290 for err in errors:
291 codecs.register_error("test." + err, codecs.lookup_error(err))
292 l = 1000
293 errors += [ "test." + err for err in errors ]
294 for uni in [ s*l for s in ("x", "\u3042", "a\xe4") ]:
295 for enc in ("ascii", "latin-1", "iso-8859-1", "iso-8859-15",
296 "utf-8", "utf-7", "utf-16", "utf-32"):
297 for err in errors:
298 try:
299 uni.encode(enc, err)
300 except UnicodeError:
301 pass
302
303 def check_exceptionobjectargs(self, exctype, args, msg):
304 # Test UnicodeError subclasses: construction, attribute assignment and __str__ conversion

Callers

nothing calls this directly

Calls 3

register_errorMethod · 0.80
lookup_errorMethod · 0.80
encodeMethod · 0.45

Tested by

no test coverage detected