saferepr: Avoid indirect function calls
The DRY savings they provide are rather small, while they make it harder to type-check, and IMO harder to understand.
This commit is contained in:
@@ -45,6 +45,17 @@ def test_exceptions():
|
||||
assert "unknown" in s2
|
||||
|
||||
|
||||
def test_buggy_builtin_repr():
|
||||
# Simulate a case where a repr for a builtin raises.
|
||||
# reprlib dispatches by type name, so use "int".
|
||||
|
||||
class int:
|
||||
def __repr__(self):
|
||||
raise ValueError("Buggy repr!")
|
||||
|
||||
assert "Buggy" in saferepr(int())
|
||||
|
||||
|
||||
def test_big_repr():
|
||||
from _pytest._io.saferepr import SafeRepr
|
||||
|
||||
|
||||
Reference in New Issue
Block a user