MCPcopy
hub / github.com/pytest-dev/pytest / test_real_func_loop_limit

Function test_real_func_loop_limit

testing/test_compat.py:20–40  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

18
19
20def test_real_func_loop_limit() -> None:
21 class Evil:
22 def __init__(self):
23 self.left = 1000
24
25 def __repr__(self):
26 return f"<Evil left={self.left}>"
27
28 def __getattr__(self, attr):
29 if not self.left:
30 raise RuntimeError("it's over") # pragma: no cover
31 self.left -= 1
32 return self
33
34 evil = Evil()
35
36 with pytest.raises(
37 ValueError,
38 match=("wrapper loop when unwrapping <Evil left=998>"),
39 ):
40 get_real_func(evil)
41
42
43def test_get_real_func() -> None:

Callers

nothing calls this directly

Calls 2

get_real_funcFunction · 0.90
EvilClass · 0.85

Tested by

no test coverage detected