mirror of
https://github.com/python/cpython.git
synced 2025-12-11 11:31:05 +00:00
bpo-46437: remove useless hasattr from test_typing (#30704)
This commit is contained in:
parent
4b99803b86
commit
263c0dd160
1 changed files with 7 additions and 9 deletions
|
|
@ -3513,11 +3513,10 @@ class CollectionsAbcTests(BaseTestCase):
|
||||||
self.assertNotIsInstance(42, typing.Container)
|
self.assertNotIsInstance(42, typing.Container)
|
||||||
|
|
||||||
def test_collection(self):
|
def test_collection(self):
|
||||||
if hasattr(typing, 'Collection'):
|
self.assertIsInstance(tuple(), typing.Collection)
|
||||||
self.assertIsInstance(tuple(), typing.Collection)
|
self.assertIsInstance(frozenset(), typing.Collection)
|
||||||
self.assertIsInstance(frozenset(), typing.Collection)
|
self.assertIsSubclass(dict, typing.Collection)
|
||||||
self.assertIsSubclass(dict, typing.Collection)
|
self.assertNotIsInstance(42, typing.Collection)
|
||||||
self.assertNotIsInstance(42, typing.Collection)
|
|
||||||
|
|
||||||
def test_abstractset(self):
|
def test_abstractset(self):
|
||||||
self.assertIsInstance(set(), typing.AbstractSet)
|
self.assertIsInstance(set(), typing.AbstractSet)
|
||||||
|
|
@ -5130,8 +5129,9 @@ class AllTests(BaseTestCase):
|
||||||
self.assertIn('ValuesView', a)
|
self.assertIn('ValuesView', a)
|
||||||
self.assertIn('cast', a)
|
self.assertIn('cast', a)
|
||||||
self.assertIn('overload', a)
|
self.assertIn('overload', a)
|
||||||
if hasattr(contextlib, 'AbstractContextManager'):
|
# Context managers.
|
||||||
self.assertIn('ContextManager', a)
|
self.assertIn('ContextManager', a)
|
||||||
|
self.assertIn('AsyncContextManager', a)
|
||||||
# Check that io and re are not exported.
|
# Check that io and re are not exported.
|
||||||
self.assertNotIn('io', a)
|
self.assertNotIn('io', a)
|
||||||
self.assertNotIn('re', a)
|
self.assertNotIn('re', a)
|
||||||
|
|
@ -5145,8 +5145,6 @@ class AllTests(BaseTestCase):
|
||||||
self.assertIn('SupportsComplex', a)
|
self.assertIn('SupportsComplex', a)
|
||||||
|
|
||||||
def test_all_exported_names(self):
|
def test_all_exported_names(self):
|
||||||
import typing
|
|
||||||
|
|
||||||
actual_all = set(typing.__all__)
|
actual_all = set(typing.__all__)
|
||||||
computed_all = {
|
computed_all = {
|
||||||
k for k, v in vars(typing).items()
|
k for k, v in vars(typing).items()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue