diff options
author | rfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f> | 2011-03-19 05:29:09 +0000 |
---|---|---|
committer | rfkelly0 <rfkelly0@67cdc799-7952-0410-af00-57a81ceafa0f> | 2011-03-19 05:29:09 +0000 |
commit | 76cf876f1281de73ac6dbfbdc995673efc035c80 (patch) | |
tree | b870bf999dc7889ce53ba392d697cddfc42c4ec6 /fs/tests | |
parent | 1bdb9b8159e041201ad3de9eaf0e4e0cc41f10a0 (diff) | |
download | pyfilesystem-76cf876f1281de73ac6dbfbdc995673efc035c80.tar.gz |
add testcase for writing past the end of a file
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@672 67cdc799-7952-0410-af00-57a81ceafa0f
Diffstat (limited to 'fs/tests')
-rw-r--r-- | fs/tests/__init__.py | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fs/tests/__init__.py b/fs/tests/__init__.py index f0fd8b1..bcbcdf3 100644 --- a/fs/tests/__init__.py +++ b/fs/tests/__init__.py @@ -741,6 +741,15 @@ class FSTestCases(object): f.seek(25) self.assertEquals(f.read(),"123456") + def test_write_past_end_of_file(self): + if self.fs.getmeta('file.read_and_write', True): + with self.fs.open("write_at_end","w") as f: + f.seek(25) + f.write("EOF") + with self.fs.open("write_at_end","r") as f: + self.assertEquals(f.read(),"\x00"*25 + "EOF") + + def test_with_statement(self): # This is a little tricky since 'with' is actually new syntax. # We use eval() to make this method safe for old python versions. |