Skip to content

Commit 7941c73

Browse files
Евгений БлиновЕвгений Блинов
authored andcommitted
Update test to assert return value is preserved
1 parent d4faccf commit 7941c73

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

tests/test_autorestore.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,16 +7,18 @@
77

88

99
def test_restore():
10-
"""Restore the pre-call sys.displayhook after a decorated function changes it and returns normally."""
10+
"""Restore the pre-call sys.displayhook and preserve the return value after a decorated function changes it."""
1111
hook_before_declaration = sys.displayhook
12+
result = object()
1213

1314
@autorestore_displayhook
1415
def do_something():
1516
sys.displayhook = 5
17+
return result
1618

1719
hook_before_calling = sys.displayhook
1820

19-
do_something()
21+
assert do_something() is result
2022

2123
assert hook_before_declaration is sys.displayhook
2224
assert hook_before_calling is sys.displayhook

0 commit comments

Comments
 (0)