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

Function test_broken_getattribute

testing/io/test_saferepr.py:167–181  ·  view source on GitHub ↗

saferepr() can create proper representations of classes with broken __getattribute__ (#7145)

()

Source from the content-addressed store, hash-verified

165
166
167def test_broken_getattribute():
168 """saferepr() can create proper representations of classes with
169 broken __getattribute__ (#7145)
170 """
171
172 class SomeClass:
173 def __getattribute__(self, attr):
174 raise RuntimeError
175
176 def __repr__(self):
177 raise RuntimeError
178
179 assert saferepr(SomeClass()).startswith(
180 "<[RuntimeError() raised in repr()] SomeClass object at 0x"
181 )

Callers

nothing calls this directly

Calls 2

safereprFunction · 0.90
SomeClassClass · 0.70

Tested by

no test coverage detected