summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwillmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f>2013-09-09 20:21:02 +0000
committerwillmcgugan@gmail.com <willmcgugan@gmail.com@67cdc799-7952-0410-af00-57a81ceafa0f>2013-09-09 20:21:02 +0000
commit56b0970df73b4d452773d02e8e7da3b3d39c76b0 (patch)
tree5d1a74651a0442fda72a2959c661c2a59975625e
parent596d17b240b79ed4fb1da3de4cef15dc53feaae1 (diff)
downloadpyfilesystem-56b0970df73b4d452773d02e8e7da3b3d39c76b0.tar.gz
Added test for read(0) (should return empty string)
git-svn-id: http://pyfilesystem.googlecode.com/svn/trunk@868 67cdc799-7952-0410-af00-57a81ceafa0f
-rw-r--r--fs/tests/__init__.py8
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