summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_fileio.py
diff options
context:
space:
mode:
authorWalter Dörwald <walter@livinglogic.de>2007-06-06 16:31:14 (GMT)
committerWalter Dörwald <walter@livinglogic.de>2007-06-06 16:31:14 (GMT)
commit3a77c7ab16d737a19cfb3fae4bd0f92517abe149 (patch)
treea106a1d6a89baf1d9077e49ca78081123fc42b93 /Lib/test/test_fileio.py
parentfee1af9d1cf1836113e61e41acd8e913736644a1 (diff)
downloadcpython-3a77c7ab16d737a19cfb3fae4bd0f92517abe149.zip
cpython-3a77c7ab16d737a19cfb3fae4bd0f92517abe149.tar.gz
cpython-3a77c7ab16d737a19cfb3fae4bd0f92517abe149.tar.bz2
If append mode is specified seek to the end of the file.
Add a test to test_fileio.py for this.
Diffstat (limited to 'Lib/test/test_fileio.py')
-rw-r--r--Lib/test/test_fileio.py18
1 files changed, 18 insertions, 0 deletions
diff --git a/Lib/test/test_fileio.py b/Lib/test/test_fileio.py
index 064ec0c..8cf79df 100644
--- a/Lib/test/test_fileio.py
+++ b/Lib/test/test_fileio.py
@@ -205,6 +205,24 @@ class OtherFileTests(unittest.TestCase):
finally:
os.unlink(TESTFN)
+ def testAppend(self):
+ try:
+ f = open(TESTFN, 'wb')
+ f.write(b'spam')
+ f.close()
+ f = open(TESTFN, 'ab')
+ f.write(b'eggs')
+ f.close()
+ f = open(TESTFN, 'rb')
+ d = f.read()
+ f.close()
+ self.assertEqual(d, b'spameggs')
+ finally:
+ try:
+ os.unlink(TESTFN)
+ except:
+ pass
+
def test_main():
# Historically, these tests have been sloppy about removing TESTFN.
# So get rid of it no matter what.