X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/8b7ea9235e5761beab0dbc92d9c400574f672a15..da85b5f1617656e03535dc490f027d7fae4d702e:/sdk/python/tests/test_collections.py?ds=sidebyside diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py index d867f7ba93..5354f3a9f7 100644 --- a/sdk/python/tests/test_collections.py +++ b/sdk/python/tests/test_collections.py @@ -127,7 +127,7 @@ class ArvadosCollectionsTest(ArvadosKeepLocalStoreTestCase): cw.start_new_file('zero.txt') cw.write('') - self.assertEqual(cw.manifest_text(), ". 0:0:zero.txt\n") + self.assertEqual(cw.manifest_text(), ". d41d8cd98f00b204e9800998ecf8427e+0 0:0:zero.txt\n") self.check_manifest_file_sizes(cw.manifest_text(), [0]) cw = arvados.CollectionWriter() cw.start_new_file('zero.txt') @@ -436,6 +436,26 @@ class ArvadosCollectionsTest(ArvadosKeepLocalStoreTestCase): self.assertEqual(sr.readfrom(25, 5), content[25:30]) self.assertEqual(sr.readfrom(30, 5), '') + def test_file_reader(self): + keepblocks = {'aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa+10': 'abcdefghij', + 'bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb+15': 'klmnopqrstuvwxy', + 'cccccccccccccccccccccccccccccccc+5': 'z0123'} + mk = self.MockKeep(keepblocks) + + sr = arvados.StreamReader([".", "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa+10", "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb+15", "cccccccccccccccccccccccccccccccc+5", "0:10:foo", "15:10:foo"], mk) + + content = 'abcdefghijpqrstuvwxy' + + f = sr.files()["foo"] + + f.seek(0) + self.assertEqual(f.read(20), content[0:20]) + + f.seek(0) + self.assertEqual(f.read(6), content[0:6]) + self.assertEqual(f.read(6), content[6:12]) + self.assertEqual(f.read(6), content[12:18]) + def test_extract_file(self): m1 = """. 5348b82a029fd9e971a811ce1f71360b+43 0:43:md5sum.txt . 085c37f02916da1cad16f93c54d899b7+41 0:41:md6sum.txt