diff options
author | Benjamin Peterson <benjamin@python.org> | 2009-12-13 19:25:34 +0000 |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2009-12-13 19:25:34 +0000 |
commit | bf5ff765970a15255a06e4a4ee7f18b5745079ad (patch) | |
tree | ac106a4885c12c27a624f296ee0a08d5d6b195c4 /Lib/test/test_fileio.py | |
parent | 229663775dd6c869e8daceea6d92af638afa520f (diff) | |
download | cpython-git-bf5ff765970a15255a06e4a4ee7f18b5745079ad.tar.gz |
Merged revisions 76805 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r76805 | benjamin.peterson | 2009-12-13 13:19:07 -0600 (Sun, 13 Dec 2009) | 7 lines
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 4ce3746b36..4e6e1b59b4 100644 --- a/Lib/test/test_fileio.py +++ b/Lib/test/test_fileio.py @@ -69,6 +69,15 @@ class AutoFileTests(unittest.TestCase): n = self.f.readinto(a) self.assertEquals(array('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=%r>" % (self.f.name, self.f.mode)) |