88import re
99import sys
1010import warnings
11- from test .support .import_helper import import_fresh_module
1211from unittest import TestCase , main , skipUnless , skip
1312from unittest .mock import patch
1413from copy import copy , deepcopy
@@ -3909,14 +3908,7 @@ class MyChain(typing.ChainMap[str, T]): ...
39093908 self .assertEqual (MyChain [int ]().__orig_class__ , MyChain [int ])
39103909
39113910 def test_all_repr_eq_any (self ):
3912- typing = import_fresh_module ("typing" )
3913- with warnings .catch_warnings (record = True ) as wlog :
3914- warnings .filterwarnings ('always' , '' , DeprecationWarning )
3915- objs = [getattr (typing , el ) for el in typing .__all__ ]
3916- self .assertEqual (
3917- [str (w .message ) for w in wlog ],
3918- ["'typing.ByteString' is deprecated and slated for removal in Python 3.14" ]
3919- )
3911+ objs = (getattr (typing , el ) for el in typing .__all__ )
39203912 for obj in objs :
39213913 self .assertNotEqual (repr (obj ), '' )
39223914 self .assertEqual (obj , obj )
@@ -6005,15 +5997,13 @@ def test_mutablesequence(self):
60055997
60065998 def test_bytestring (self ):
60075999 with self .assertWarns (DeprecationWarning ):
6008- from typing import ByteString
6000+ self . assertIsInstance ( b'' , typing . ByteString )
60096001 with self .assertWarns (DeprecationWarning ):
6010- self .assertIsInstance (b'' , ByteString )
6002+ self .assertIsInstance (bytearray ( b'' ), typing . ByteString )
60116003 with self .assertWarns (DeprecationWarning ):
6012- self . assertIsInstance ( bytearray ( b'' ), ByteString )
6004+ class Foo ( typing . ByteString ): ...
60136005 with self .assertWarns (DeprecationWarning ):
6014- class Foo (ByteString ): ...
6015- with self .assertWarns (DeprecationWarning ):
6016- class Bar (ByteString , typing .Awaitable ): ...
6006+ class Bar (typing .ByteString , typing .Awaitable ): ...
60176007
60186008 def test_list (self ):
60196009 self .assertIsSubclass (list , typing .List )
@@ -8309,10 +8299,6 @@ def test_no_isinstance(self):
83098299class SpecialAttrsTests (BaseTestCase ):
83108300
83118301 def test_special_attrs (self ):
8312- with warnings .catch_warnings (
8313- action = 'ignore' , category = DeprecationWarning
8314- ):
8315- typing_ByteString = typing .ByteString
83168302 cls_to_check = {
83178303 # ABC classes
83188304 typing .AbstractSet : 'AbstractSet' ,
@@ -8321,7 +8307,7 @@ def test_special_attrs(self):
83218307 typing .AsyncIterable : 'AsyncIterable' ,
83228308 typing .AsyncIterator : 'AsyncIterator' ,
83238309 typing .Awaitable : 'Awaitable' ,
8324- typing_ByteString : 'ByteString' ,
8310+ typing . ByteString : 'ByteString' ,
83258311 typing .Callable : 'Callable' ,
83268312 typing .ChainMap : 'ChainMap' ,
83278313 typing .Collection : 'Collection' ,
@@ -8646,8 +8632,6 @@ def test_all_exported_names(self):
86468632 getattr (v , '__module__' , None ) == typing .__name__
86478633 )
86488634 }
8649- # Deprecated; added dynamically via module __getattr__
8650- computed_all .add ("ByteString" )
86518635 self .assertSetEqual (computed_all , actual_all )
86528636
86538637
0 commit comments