MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_real_func_loop_limit

Function test_real_func_loop_limit

testing/test_compat.py:33–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

31
32
33def test_real_func_loop_limit() -> None:
34 class Evil:
35 def __init__(self):
36 self.left = 1000
37
38 def __repr__(self):
39 return f"<Evil left={self.left}>"
40
41 def __getattr__(self, attr):
42 if not self.left:
43 raise RuntimeError("it's over") # pragma: no cover
44 self.left -= 1
45 return self
46
47 evil = Evil()
48
49 with pytest.raises(
50 ValueError,
51 match=(
52 "could not find real function of <Evil left=800>\n"
53 "stopped at <Evil left=800>"
54 ),
55 ):
56 get_real_func(evil)
57
58
59def 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