[Python-checkins] cpython (3.5): Sync test_typing.py with upstream git repo (typing.py was already synced).
guido.van.rossum
python-checkins at python.org
Sun Apr 17 20:54:13 EDT 2016
https://hg.python.org/cpython/rev/31cd179c9451
changeset: 101041:31cd179c9451
branch: 3.5
parent: 101036:395dd5630e6c
user: Guido van Rossum <guido at python.org>
date: Sun Apr 17 17:52:05 2016 -0700
summary:
Sync test_typing.py with upstream git repo (typing.py was already synced).
files:
Lib/test/test_typing.py | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -1,3 +1,4 @@
+import contextlib
import pickle
import re
import sys
@@ -1309,6 +1310,21 @@
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):
@@ -1447,12 +1463,16 @@
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__':
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list