test fake attributes

This commit is contained in:
Will McGugan 2021-09-18 09:43:09 +01:00
parent ce512856dd
commit f934b09ecb
2 changed files with 22 additions and 2 deletions

View file

@ -250,3 +250,15 @@ def test_user_dict():
result = pretty_repr(d2, expand_all=True)
print(repr(result))
assert result == "FOO"
def test_lying_attribute():
"""Test getattr doesn't break rich repr protocol"""
class Foo:
def __getattr__(self, attr):
return "foo"
foo = Foo()
result = pretty_repr(foo)
assert "Foo" in result