summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-01-19 14:30:07 -0800
committerGitHub <noreply@github.com>2022-01-19 14:30:07 -0800
commit07b12fdf5545a20e0fb7be9d6ad35344337e00ae (patch)
tree0699530b1aed436a5514dbe12e8556ffd90109c5
parentee077500888ca5c1360bbd224b3af4a0fbbf6e02 (diff)
downloadcpython-git-07b12fdf5545a20e0fb7be9d6ad35344337e00ae.tar.gz
bpo-46437: remove useless `hasattr` from `test_typing` (GH-30704)
(cherry picked from commit 263c0dd16017613c5ea2fbfc270be4de2b41b5ad) Co-authored-by: Nikita Sobolev <mail@sobolevn.me>
-rw-r--r--Lib/test/test_typing.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/Lib/test/test_typing.py b/Lib/test/test_typing.py
index ee432b65cf..1d16e78d42 100644
--- a/Lib/test/test_typing.py
+++ b/Lib/test/test_typing.py
@@ -3439,11 +3439,10 @@ class CollectionsAbcTests(BaseTestCase):
self.assertNotIsInstance(42, typing.Container)
def test_collection(self):
- if hasattr(typing, 'Collection'):
- self.assertIsInstance(tuple(), typing.Collection)
- self.assertIsInstance(frozenset(), typing.Collection)
- self.assertIsSubclass(dict, typing.Collection)
- self.assertNotIsInstance(42, typing.Collection)
+ self.assertIsInstance(tuple(), typing.Collection)
+ self.assertIsInstance(frozenset(), typing.Collection)
+ self.assertIsSubclass(dict, typing.Collection)
+ self.assertNotIsInstance(42, typing.Collection)
def test_abstractset(self):
self.assertIsInstance(set(), typing.AbstractSet)
@@ -5033,8 +5032,9 @@ class AllTests(BaseTestCase):
self.assertIn('ValuesView', a)
self.assertIn('cast', a)
self.assertIn('overload', a)
- if hasattr(contextlib, 'AbstractContextManager'):
- self.assertIn('ContextManager', a)
+ # Context managers.
+ self.assertIn('ContextManager', a)
+ self.assertIn('AsyncContextManager', a)
# Check that io and re are not exported.
self.assertNotIn('io', a)
self.assertNotIn('re', a)
@@ -5048,8 +5048,6 @@ class AllTests(BaseTestCase):
self.assertIn('SupportsComplex', a)
def test_all_exported_names(self):
- import typing
-
actual_all = set(typing.__all__)
computed_all = {
k for k, v in vars(typing).items()