Permalink
Browse files

test_seek

  • Loading branch information...
1 parent c047e29 commit 0d5123d76a2fb972299c1f53d0e0d6ca2a77a673 @mikejs committed Oct 2, 2009
Showing with 18 additions and 0 deletions.
  1. +18 −0 tests/basic.py
View
@@ -103,6 +103,24 @@ def test_big_file(self):
self.assertEquals(size, os.stat(path).st_size)
+ def test_seek(self):
+ path = os.path.join(self.mount, 'file')
+ size1 = 256 * 1024 * 3
+ data1 = 'A' * size1
+ data2 = 'B' * size1
+ expected = ('A' * (size1 / 2)) + data2
+ size2 = len(expected)
+
+ with open(path, 'w') as w:
+ w.write(data1)
+ w.seek(size1 / 2)
+ w.write(data2)
+
+ with open(path, 'r') as r:
+ self.assertEquals(expected, r.read())
+
+ self.assertEquals(size2, os.stat(path).st_size)
+
def suite():
suite = unittest.TestSuite()
suite.addTest(BasicGridfsFUSETestCase())

0 comments on commit 0d5123d

Please sign in to comment.