@@ -3949,19 +3949,18 @@ class PyIncrementalNewlineDecoderTest(IncrementalNewlineDecoderTest):
3949
3949
3950
3950
class MiscIOTest (unittest .TestCase ):
3951
3951
3952
+ # for test__all__, actual values are set in subclasses
3953
+ name_of_module = None
3954
+ extra_exported = ()
3955
+ not_exported = ()
3956
+
3952
3957
def tearDown (self ):
3953
3958
os_helper .unlink (os_helper .TESTFN )
3954
3959
3955
3960
def test___all__ (self ):
3956
- for name in self .io .__all__ :
3957
- obj = getattr (self .io , name , None )
3958
- self .assertIsNotNone (obj , name )
3959
- if name in ("open" , "open_code" ):
3960
- continue
3961
- elif "error" in name .lower () or name == "UnsupportedOperation" :
3962
- self .assertTrue (issubclass (obj , Exception ), name )
3963
- elif not name .startswith ("SEEK_" ):
3964
- self .assertTrue (issubclass (obj , self .IOBase ))
3961
+ support .check__all__ (self , self .io , self .name_of_module ,
3962
+ extra = self .extra_exported ,
3963
+ not_exported = self .not_exported )
3965
3964
3966
3965
def test_attributes (self ):
3967
3966
f = self .open (os_helper .TESTFN , "wb" , buffering = 0 )
@@ -4328,6 +4327,8 @@ def test_openwrapper(self):
4328
4327
4329
4328
class CMiscIOTest (MiscIOTest ):
4330
4329
io = io
4330
+ name_of_module = "io" , "_io"
4331
+ extra_exported = "BlockingIOError" ,
4331
4332
4332
4333
def test_readinto_buffer_overflow (self ):
4333
4334
# Issue #18025
@@ -4392,6 +4393,9 @@ def test_daemon_threads_shutdown_stderr_deadlock(self):
4392
4393
4393
4394
class PyMiscIOTest (MiscIOTest ):
4394
4395
io = pyio
4396
+ name_of_module = "_pyio" , "io"
4397
+ extra_exported = "BlockingIOError" , "open_code" ,
4398
+ not_exported = "valid_seek_flags" ,
4395
4399
4396
4400
4397
4401
@unittest .skipIf (os .name == 'nt' , 'POSIX signals required for this test.' )
@@ -4679,7 +4683,7 @@ def load_tests(loader, tests, pattern):
4679
4683
mocks = (MockRawIO , MisbehavedRawIO , MockFileIO , CloseFailureIO ,
4680
4684
MockNonBlockWriterIO , MockUnseekableIO , MockRawIOWithoutRead ,
4681
4685
SlowFlushRawIO )
4682
- all_members = io .__all__ + [ "IncrementalNewlineDecoder" ]
4686
+ all_members = io .__all__
4683
4687
c_io_ns = {name : getattr (io , name ) for name in all_members }
4684
4688
py_io_ns = {name : getattr (pyio , name ) for name in all_members }
4685
4689
globs = globals ()
0 commit comments