@@ -3439,11 +3439,10 @@ def test_container(self):
3439
3439
self .assertNotIsInstance (42 , typing .Container )
3440
3440
3441
3441
def test_collection (self ):
3442
- if hasattr (typing , 'Collection' ):
3443
- self .assertIsInstance (tuple (), typing .Collection )
3444
- self .assertIsInstance (frozenset (), typing .Collection )
3445
- self .assertIsSubclass (dict , typing .Collection )
3446
- self .assertNotIsInstance (42 , typing .Collection )
3442
+ self .assertIsInstance (tuple (), typing .Collection )
3443
+ self .assertIsInstance (frozenset (), typing .Collection )
3444
+ self .assertIsSubclass (dict , typing .Collection )
3445
+ self .assertNotIsInstance (42 , typing .Collection )
3447
3446
3448
3447
def test_abstractset (self ):
3449
3448
self .assertIsInstance (set (), typing .AbstractSet )
@@ -5033,8 +5032,9 @@ def test_all(self):
5033
5032
self .assertIn ('ValuesView' , a )
5034
5033
self .assertIn ('cast' , a )
5035
5034
self .assertIn ('overload' , a )
5036
- if hasattr (contextlib , 'AbstractContextManager' ):
5037
- self .assertIn ('ContextManager' , a )
5035
+ # Context managers.
5036
+ self .assertIn ('ContextManager' , a )
5037
+ self .assertIn ('AsyncContextManager' , a )
5038
5038
# Check that io and re are not exported.
5039
5039
self .assertNotIn ('io' , a )
5040
5040
self .assertNotIn ('re' , a )
@@ -5048,8 +5048,6 @@ def test_all(self):
5048
5048
self .assertIn ('SupportsComplex' , a )
5049
5049
5050
5050
def test_all_exported_names (self ):
5051
- import typing
5052
-
5053
5051
actual_all = set (typing .__all__ )
5054
5052
computed_all = {
5055
5053
k for k , v in vars (typing ).items ()
0 commit comments