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

Method test_evil_repr3

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 4

assertRaisesMethod · 0.95
GenericAliasFunction · 0.90
reprFunction · 0.85
XClass · 0.70

Tested by

no test coverage detected