@@ -1072,6 +1072,12 @@ def test_garbage_collection(self):
10721072 support .gc_collect ()
10731073 self .assertTrue (wr () is None , wr )
10741074
1075+ def test_args_error (self ):
1076+ # Issue #17275
1077+ with self .assertRaisesRegex (TypeError , "BufferedReader" ):
1078+ self .tp (io .BytesIO (), 1024 , 1024 , 1024 )
1079+
1080+
10751081class PyBufferedReaderTest (BufferedReaderTest ):
10761082 tp = pyio .BufferedReader
10771083
@@ -1363,6 +1369,11 @@ def test_garbage_collection(self):
13631369 with self .open (support .TESTFN , "rb" ) as f :
13641370 self .assertEqual (f .read (), b"123xxx" )
13651371
1372+ def test_args_error (self ):
1373+ # Issue #17275
1374+ with self .assertRaisesRegex (TypeError , "BufferedWriter" ):
1375+ self .tp (io .BytesIO (), 1024 , 1024 , 1024 )
1376+
13661377
13671378class PyBufferedWriterTest (BufferedWriterTest ):
13681379 tp = pyio .BufferedWriter
@@ -1715,6 +1726,7 @@ def test_interleaved_readline_write(self):
17151726 # You can't construct a BufferedRandom over a non-seekable stream.
17161727 test_unseekable = None
17171728
1729+
17181730class CBufferedRandomTest (BufferedRandomTest , SizeofTest ):
17191731 tp = io .BufferedRandom
17201732
@@ -1732,6 +1744,12 @@ def test_garbage_collection(self):
17321744 CBufferedReaderTest .test_garbage_collection (self )
17331745 CBufferedWriterTest .test_garbage_collection (self )
17341746
1747+ def test_args_error (self ):
1748+ # Issue #17275
1749+ with self .assertRaisesRegex (TypeError , "BufferedRandom" ):
1750+ self .tp (io .BytesIO (), 1024 , 1024 , 1024 )
1751+
1752+
17351753class PyBufferedRandomTest (BufferedRandomTest ):
17361754 tp = pyio .BufferedRandom
17371755
0 commit comments