mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-27 22:31:12 +08:00
contextlib: Remove explicit base class from ExitStack (#7963)
Fixes #7961
This commit is contained in:
18
test_cases/stdlib/test_contextlib.py
Normal file
18
test_cases/stdlib/test_contextlib.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from contextlib import ExitStack
|
||||
from typing_extensions import assert_type
|
||||
|
||||
|
||||
# See issue #7961
|
||||
class Thing(ExitStack):
|
||||
pass
|
||||
|
||||
|
||||
stack = ExitStack()
|
||||
thing = Thing()
|
||||
assert_type(stack.enter_context(Thing()), Thing)
|
||||
assert_type(thing.enter_context(ExitStack()), ExitStack)
|
||||
|
||||
with stack as cm:
|
||||
assert_type(cm, ExitStack)
|
||||
with thing as cm2:
|
||||
assert_type(cm2, Thing)
|
||||
Reference in New Issue
Block a user