[ARVADOS] created: 47f29d75759db7e4d81203e110257f1a471f82e7

Git user git at public.curoverse.com
Tue May 9 15:31:52 EDT 2017


        at  47f29d75759db7e4d81203e110257f1a471f82e7 (commit)


commit 47f29d75759db7e4d81203e110257f1a471f82e7
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue May 9 15:31:44 2017 -0400

    11308: Fix modes not tested in test case.

diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py
index 99bca04..77ec7bb 100644
--- a/sdk/python/tests/test_collections.py
+++ b/sdk/python/tests/test_collections.py
@@ -832,7 +832,7 @@ class CollectionOpenModes(run_test_server.TestCaseWithServers):
     def test_open_binary_modes(self):
         c = Collection()
         for mode in ['wb', 'wb+', 'ab', 'ab+']:
-            with c.open('foo', 'wb') as f:
+            with c.open('foo', mode) as f:
                 f.write(b'foo')
 
     def test_open_invalid_modes(self):

commit 8e0303a592671af3578af904370d226f4991e635
Author: Tom Clegg <tom at curoverse.com>
Date:   Tue May 9 15:30:19 2017 -0400

    11308: collection.keys() supports indexing for python2 callers.

diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index 5008450..1f50673 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -725,7 +725,7 @@ class RichCollectionBase(CollectionBase):
     @synchronized
     def keys(self):
         """Get a list of names of files and collections directly contained in this collection."""
-        return viewkeys(self._items)
+        return self._items.keys()
 
     @synchronized
     def values(self):
diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py
index 24fedea..99bca04 100644
--- a/sdk/python/tests/test_collections.py
+++ b/sdk/python/tests/test_collections.py
@@ -804,6 +804,29 @@ class CollectionWriterTestCase(unittest.TestCase, CollectionTestMixin):
         self.assertRaises(arvados.errors.AssertionError, writer.open, 'two')
 
 
+class CollectionMethods(run_test_server.TestCaseWithServers):
+
+    def test_keys_values_items_support_indexing(self):
+        c = Collection()
+        with c.open('foo', 'wb') as f:
+            f.write(b'foo')
+        with c.open('bar', 'wb') as f:
+            f.write(b'bar')
+        self.assertEqual(2, len(c.keys()))
+        if sys.version_info < (3, 0):
+            # keys() supports indexing only for python2 callers.
+            fn0 = c.keys()[0]
+            fn1 = c.keys()[1]
+        else:
+            fn0, fn1 = c.keys()
+        self.assertEqual(2, len(c.values()))
+        f0 = c.values()[0]
+        f1 = c.values()[1]
+        self.assertEqual(2, len(c.items()))
+        self.assertEqual(fn0, c.items()[0][0])
+        self.assertEqual(fn1, c.items()[1][0])
+
+
 class CollectionOpenModes(run_test_server.TestCaseWithServers):
 
     def test_open_binary_modes(self):

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list