mirror of
https://github.com/Textualize/rich.git
synced 2025-08-04 01:58:24 +00:00
test fake attributes
This commit is contained in:
parent
ce512856dd
commit
f934b09ecb
2 changed files with 22 additions and 2 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue