+import contextlib
import pickle
import re
import sys
assert len(MMB[KT, VT]()) == 0
+class OtherABCTests(TestCase):
+
+ @skipUnless(hasattr(typing, 'ContextManager'),
+ 'requires typing.ContextManager')
+ def test_contextmanager(self):
+ @contextlib.contextmanager
+ def manager():
+ yield 42
+
+ cm = manager()
+ assert isinstance(cm, typing.ContextManager)
+ assert isinstance(cm, typing.ContextManager[int])
+ assert not isinstance(42, typing.ContextManager)
+
+
class NamedTupleTests(TestCase):
def test_basics(self):
assert 'ValuesView' in a
assert 'cast' in a
assert 'overload' in a
+ if hasattr(contextlib, 'AbstractContextManager'):
+ assert 'ContextManager' in a
# Check that io and re are not exported.
assert 'io' not in a
assert 're' not in a
# Spot-check that stdlib modules aren't exported.
assert 'os' not in a
assert 'sys' not in a
+ # Check that Text is defined.
+ assert 'Text' in a
if __name__ == '__main__':