diff options
author | Nicolas Tessore <n.tessore@ucl.ac.uk> | 2023-11-10 07:18:52 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-11-10 16:18:52 +0900 |
commit | baeb7718f8981319c5cb1fbdd46d162ded7964ea (patch) | |
tree | a8921cd9d4d6acdcd2e6cdd1e0b87b95e4a26457 /Lib/test/test_io.py | |
parent | 289af8612283508b67d7969d7182070381b4349b (diff) | |
download | cpython-baeb7718f8981319c5cb1fbdd46d162ded7964ea.tar.gz cpython-baeb7718f8981319c5cb1fbdd46d162ded7964ea.zip |
gh-111356: io: Add missing documented objects to io.__all__ (#111370)
Add DEFAULT_BUFFER_SIZE, text_encoding, and IncrementalNewlineDecoder.
Diffstat (limited to 'Lib/test/test_io.py')
-rw-r--r-- | Lib/test/test_io.py | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/Lib/test/test_io.py b/Lib/test/test_io.py index 4c80429684e..3c3be870fac 100644 --- a/Lib/test/test_io.py +++ b/Lib/test/test_io.py @@ -4042,19 +4042,18 @@ class PyIncrementalNewlineDecoderTest(IncrementalNewlineDecoderTest): class MiscIOTest(unittest.TestCase): + # for test__all__, actual values are set in subclasses + name_of_module = None + extra_exported = () + not_exported = () + def tearDown(self): os_helper.unlink(os_helper.TESTFN) def test___all__(self): - for name in self.io.__all__: - obj = getattr(self.io, name, None) - self.assertIsNotNone(obj, name) - if name in ("open", "open_code"): - continue - elif "error" in name.lower() or name == "UnsupportedOperation": - self.assertTrue(issubclass(obj, Exception), name) - elif not name.startswith("SEEK_"): - self.assertTrue(issubclass(obj, self.IOBase)) + support.check__all__(self, self.io, self.name_of_module, + extra=self.extra_exported, + not_exported=self.not_exported) def test_attributes(self): f = self.open(os_helper.TESTFN, "wb", buffering=0) @@ -4416,6 +4415,8 @@ class MiscIOTest(unittest.TestCase): class CMiscIOTest(MiscIOTest): io = io + name_of_module = "io", "_io" + extra_exported = "BlockingIOError", def test_readinto_buffer_overflow(self): # Issue #18025 @@ -4480,6 +4481,9 @@ class CMiscIOTest(MiscIOTest): class PyMiscIOTest(MiscIOTest): io = pyio + name_of_module = "_pyio", "io" + extra_exported = "BlockingIOError", "open_code", + not_exported = "valid_seek_flags", @unittest.skipIf(os.name == 'nt', 'POSIX signals required for this test.') @@ -4767,7 +4771,7 @@ def load_tests(loader, tests, pattern): mocks = (MockRawIO, MisbehavedRawIO, MockFileIO, CloseFailureIO, MockNonBlockWriterIO, MockUnseekableIO, MockRawIOWithoutRead, SlowFlushRawIO) - all_members = io.__all__ + ["IncrementalNewlineDecoder"] + all_members = io.__all__ c_io_ns = {name : getattr(io, name) for name in all_members} py_io_ns = {name : getattr(pyio, name) for name in all_members} globs = globals() |