We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d4faccf commit 7941c73Copy full SHA for 7941c73
1 file changed
tests/test_autorestore.py
@@ -7,16 +7,18 @@
7
8
9
def test_restore():
10
- """Restore the pre-call sys.displayhook after a decorated function changes it and returns normally."""
+ """Restore the pre-call sys.displayhook and preserve the return value after a decorated function changes it."""
11
hook_before_declaration = sys.displayhook
12
+ result = object()
13
14
@autorestore_displayhook
15
def do_something():
16
sys.displayhook = 5
17
+ return result
18
19
hook_before_calling = sys.displayhook
20
- do_something()
21
+ assert do_something() is result
22
23
assert hook_before_declaration is sys.displayhook
24
assert hook_before_calling is sys.displayhook
0 commit comments