diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-12-13 19:19:07 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-12-13 19:19:07 (GMT) |
commit | ddd392cbb9a94355a2ea32da4a42371d1333bfb8 (patch) | |
tree | f4c325ef0ec20e0e2007770992d371baa07c2bc7 /Lib/test/test_fileio.py | |
parent | e304852e21a92ef0a74c2d85c070572fddb4fba8 (diff) | |
download | cpython-ddd392cbb9a94355a2ea32da4a42371d1333bfb8.zip cpython-ddd392cbb9a94355a2ea32da4a42371d1333bfb8.tar.gz cpython-ddd392cbb9a94355a2ea32da4a42371d1333bfb8.tar.bz2 |
accept None as the same as having passed no argument in file types #7349
This is for consistency with imitation file objects like StringIO and BytesIO.
This commit also adds a few tests, where they were lacking for concerned
methods.
Diffstat (limited to 'Lib/test/test_fileio.py')
-rw-r--r-- | Lib/test/test_fileio.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py index 87bf015..91c5251 100644 --- a/Lib/test/test_fileio.py +++ b/Lib/test/test_fileio.py @@ -71,6 +71,15 @@ class AutoFileTests(unittest.TestCase): n = self.f.readinto(a) self.assertEquals(array(b'b', [1, 2]), a[:n]) + def test_none_args(self): + self.f.write(b"hi\nbye\nabc") + self.f.close() + self.f = _FileIO(TESTFN, 'r') + self.assertEqual(self.f.read(None), b"hi\nbye\nabc") + self.f.seek(0) + self.assertEqual(self.f.readline(None), b"hi\n") + self.assertEqual(self.f.readlines(None), [b"bye\n", b"abc"]) + def testRepr(self): self.assertEquals(repr(self.f), "<_io.FileIO name=%r mode='%s'>" % (self.f.name, self.f.mode)) |