From 49f250736d0d9fa0a0ff166caffcacc58d24fc1d Mon Sep 17 00:00:00 2001 From: Lokesh S Date: Wed, 20 Jul 2016 19:00:00 +0000 Subject: [PATCH] Python3 fixes generator object issue Fixes generator' object has no attribute 'next' issues Change-Id: I1f21eaed0ae7062073438503d3f6860d8b4f36c8 --- test/unit/container/test_backend.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/test/unit/container/test_backend.py b/test/unit/container/test_backend.py index 45b0f15423..4300b9bd28 100644 --- a/test/unit/container/test_backend.py +++ b/test/unit/container/test_backend.py @@ -560,8 +560,8 @@ class TestContainerBroker(unittest.TestCase): def _test_put_object_multiple_encoded_timestamps(self, broker): ts = (Timestamp(t) for t in itertools.count(int(time()))) - broker.initialize(ts.next().internal, 0) - t = [ts.next() for _ in range(9)] + broker.initialize(next(ts).internal, 0) + t = [next(ts) for _ in range(9)] # Create initial object broker.put_object('obj_name', t[0].internal, 123, @@ -630,8 +630,8 @@ class TestContainerBroker(unittest.TestCase): def _test_put_object_multiple_explicit_timestamps(self, broker): ts = (Timestamp(t) for t in itertools.count(int(time()))) - broker.initialize(ts.next().internal, 0) - t = [ts.next() for _ in range(11)] + broker.initialize(next(ts).internal, 0) + t = [next(ts) for _ in range(11)] # Create initial object broker.put_object('obj_name', t[0].internal, 123, @@ -735,10 +735,10 @@ class TestContainerBroker(unittest.TestCase): # timestamp as last-modified time ts = (Timestamp(t) for t in itertools.count(int(time()))) broker = ContainerBroker(':memory:', account='a', container='c') - broker.initialize(ts.next().internal, 0) + broker.initialize(next(ts).internal, 0) # simple 'single' timestamp case - t0 = ts.next() + t0 = next(ts) broker.put_object('obj1', t0.internal, 0, 'text/plain', 'hash1') listing = broker.list_objects_iter(100, '', None, None, '') self.assertEqual(len(listing), 1) @@ -746,7 +746,7 @@ class TestContainerBroker(unittest.TestCase): self.assertEqual(listing[0][1], t0.internal) # content-type and metadata are updated at t1 - t1 = ts.next() + t1 = next(ts) t_encoded = encode_timestamps(t0, t1, t1) broker.put_object('obj1', t_encoded, 0, 'text/plain', 'hash1') listing = broker.list_objects_iter(100, '', None, None, '') @@ -755,10 +755,10 @@ class TestContainerBroker(unittest.TestCase): self.assertEqual(listing[0][1], t1.internal) # used later - t2 = ts.next() + t2 = next(ts) # metadata is updated at t3 - t3 = ts.next() + t3 = next(ts) t_encoded = encode_timestamps(t0, t1, t3) broker.put_object('obj1', t_encoded, 0, 'text/plain', 'hash1') listing = broker.list_objects_iter(100, '', None, None, '') @@ -775,7 +775,7 @@ class TestContainerBroker(unittest.TestCase): self.assertEqual(listing[0][1], t3.internal) # all parts updated at t4, last-modified should be t4 - t4 = ts.next() + t4 = next(ts) t_encoded = encode_timestamps(t4, t4, t4) broker.put_object('obj1', t_encoded, 0, 'text/plain', 'hash1') listing = broker.list_objects_iter(100, '', None, None, '')