MCPcopy Index your code
hub / github.com/python/cpython / test_evil_repr3

Method test_evil_repr3

Lib/test/test_genericalias.py:286–297  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

284 self.assertTrue(repr_str.startswith("list[["), repr_str)
285
286 def test_evil_repr3(self):
287 # gh-143823
288 lst = []
289 class X:
290 def __repr__(self):
291 lst.clear()
292 return "x"
293
294 lst += [X(), 1]
295 ga = GenericAlias(int, lst)
296 with self.assertRaises(IndexError):
297 repr(ga)
298
299 def test_exposed_type(self):
300 import types

Callers

nothing calls this directly

Calls 2

assertRaisesMethod · 0.95
XClass · 0.70

Tested by

no test coverage detected