diff options
author | willmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f> | 2013-09-09 20:21:02 +0000 |
---|---|---|
committer | willmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f> | 2013-09-09 20:21:02 +0000 |
commit | e3632b736dc504f76d3b58c57b9229235eb96f46 (patch) | |
tree | 5d1a74651a0442fda72a2959c661c2a59975625e | |
parent | 5bd02f371c2f82ad225380af266c71df829264a4 (diff) | |
download | pyfilesystem-git-e3632b736dc504f76d3b58c57b9229235eb96f46.tar.gz |
Added test for read(0) (should return empty string)
-rw-r--r-- | fs/tests/__init__.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/tests/__init__.py b/fs/tests/__init__.py index 1988f64..aac08ce 100644 --- a/fs/tests/__init__.py +++ b/fs/tests/__init__.py @@ -884,6 +884,14 @@ class FSTestCases(object): def test_removeroot(self): self.assertRaises(RemoveRootError, self.fs.removedir, "/") + def test_zero_read(self): + """Test read(0) returns empty string""" + self.fs.setcontents('foo.txt', b('Hello, World'), 'wb') + with self.fs.open('foo.txt', 'rb') as f: + self.assert_(len(f.read(0)) == 0) + with self.fs.open('foo.txt', 'rt') as f: + self.assert_(len(f.read(0)) == 0) + # May be disabled - see end of file |