8
8
import re
9
9
import sys
10
10
import warnings
11
- from test .support .import_helper import import_fresh_module
12
11
from unittest import TestCase , main , skipUnless , skip
13
12
from unittest .mock import patch
14
13
from copy import copy , deepcopy
@@ -3909,14 +3908,7 @@ class MyChain(typing.ChainMap[str, T]): ...
3909
3908
self .assertEqual (MyChain [int ]().__orig_class__ , MyChain [int ])
3910
3909
3911
3910
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__ )
3920
3912
for obj in objs :
3921
3913
self .assertNotEqual (repr (obj ), '' )
3922
3914
self .assertEqual (obj , obj )
@@ -6005,15 +5997,13 @@ def test_mutablesequence(self):
6005
5997
6006
5998
def test_bytestring (self ):
6007
5999
with self .assertWarns (DeprecationWarning ):
6008
- from typing import ByteString
6000
+ self . assertIsInstance ( b'' , typing . ByteString )
6009
6001
with self .assertWarns (DeprecationWarning ):
6010
- self .assertIsInstance (b'' , ByteString )
6002
+ self .assertIsInstance (bytearray ( b'' ), typing . ByteString )
6011
6003
with self .assertWarns (DeprecationWarning ):
6012
- self . assertIsInstance ( bytearray ( b'' ), ByteString )
6004
+ class Foo ( typing . ByteString ): ...
6013
6005
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 ): ...
6017
6007
6018
6008
def test_list (self ):
6019
6009
self .assertIsSubclass (list , typing .List )
@@ -8309,10 +8299,6 @@ def test_no_isinstance(self):
8309
8299
class SpecialAttrsTests (BaseTestCase ):
8310
8300
8311
8301
def test_special_attrs (self ):
8312
- with warnings .catch_warnings (
8313
- action = 'ignore' , category = DeprecationWarning
8314
- ):
8315
- typing_ByteString = typing .ByteString
8316
8302
cls_to_check = {
8317
8303
# ABC classes
8318
8304
typing .AbstractSet : 'AbstractSet' ,
@@ -8321,7 +8307,7 @@ def test_special_attrs(self):
8321
8307
typing .AsyncIterable : 'AsyncIterable' ,
8322
8308
typing .AsyncIterator : 'AsyncIterator' ,
8323
8309
typing .Awaitable : 'Awaitable' ,
8324
- typing_ByteString : 'ByteString' ,
8310
+ typing . ByteString : 'ByteString' ,
8325
8311
typing .Callable : 'Callable' ,
8326
8312
typing .ChainMap : 'ChainMap' ,
8327
8313
typing .Collection : 'Collection' ,
@@ -8646,8 +8632,6 @@ def test_all_exported_names(self):
8646
8632
getattr (v , '__module__' , None ) == typing .__name__
8647
8633
)
8648
8634
}
8649
- # Deprecated; added dynamically via module __getattr__
8650
- computed_all .add ("ByteString" )
8651
8635
self .assertSetEqual (computed_all , actual_all )
8652
8636
8653
8637
0 commit comments