Skip to content

Commit

Permalink
bpo-46437: remove useless hasattr from test_typing (#30704)
Browse files Browse the repository at this point in the history
  • Loading branch information
sobolevn committed Jan 19, 2022
1 parent 4b99803 commit 263c0dd
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions Lib/test/test_typing.py
Expand Up @@ -3513,11 +3513,10 @@ def test_container(self):
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)
Expand Down Expand Up @@ -5130,8 +5129,9 @@ def test_all(self):
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)
Expand All @@ -5145,8 +5145,6 @@ def test_all(self):
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()
Expand Down

0 comments on commit 263c0dd

Please sign in to comment.