Python3 fixes generator object issue
Fixes generator' object has no attribute 'next' issues Change-Id: I1f21eaed0ae7062073438503d3f6860d8b4f36c8
This commit is contained in:
parent
3382a0e80e
commit
49f250736d
@ -560,8 +560,8 @@ class TestContainerBroker(unittest.TestCase):
|
|||||||
|
|
||||||
def _test_put_object_multiple_encoded_timestamps(self, broker):
|
def _test_put_object_multiple_encoded_timestamps(self, broker):
|
||||||
ts = (Timestamp(t) for t in itertools.count(int(time())))
|
ts = (Timestamp(t) for t in itertools.count(int(time())))
|
||||||
broker.initialize(ts.next().internal, 0)
|
broker.initialize(next(ts).internal, 0)
|
||||||
t = [ts.next() for _ in range(9)]
|
t = [next(ts) for _ in range(9)]
|
||||||
|
|
||||||
# Create initial object
|
# Create initial object
|
||||||
broker.put_object('obj_name', t[0].internal, 123,
|
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):
|
def _test_put_object_multiple_explicit_timestamps(self, broker):
|
||||||
ts = (Timestamp(t) for t in itertools.count(int(time())))
|
ts = (Timestamp(t) for t in itertools.count(int(time())))
|
||||||
broker.initialize(ts.next().internal, 0)
|
broker.initialize(next(ts).internal, 0)
|
||||||
t = [ts.next() for _ in range(11)]
|
t = [next(ts) for _ in range(11)]
|
||||||
|
|
||||||
# Create initial object
|
# Create initial object
|
||||||
broker.put_object('obj_name', t[0].internal, 123,
|
broker.put_object('obj_name', t[0].internal, 123,
|
||||||
@ -735,10 +735,10 @@ class TestContainerBroker(unittest.TestCase):
|
|||||||
# timestamp as last-modified time
|
# timestamp as last-modified time
|
||||||
ts = (Timestamp(t) for t in itertools.count(int(time())))
|
ts = (Timestamp(t) for t in itertools.count(int(time())))
|
||||||
broker = ContainerBroker(':memory:', account='a', container='c')
|
broker = ContainerBroker(':memory:', account='a', container='c')
|
||||||
broker.initialize(ts.next().internal, 0)
|
broker.initialize(next(ts).internal, 0)
|
||||||
|
|
||||||
# simple 'single' timestamp case
|
# simple 'single' timestamp case
|
||||||
t0 = ts.next()
|
t0 = next(ts)
|
||||||
broker.put_object('obj1', t0.internal, 0, 'text/plain', 'hash1')
|
broker.put_object('obj1', t0.internal, 0, 'text/plain', 'hash1')
|
||||||
listing = broker.list_objects_iter(100, '', None, None, '')
|
listing = broker.list_objects_iter(100, '', None, None, '')
|
||||||
self.assertEqual(len(listing), 1)
|
self.assertEqual(len(listing), 1)
|
||||||
@ -746,7 +746,7 @@ class TestContainerBroker(unittest.TestCase):
|
|||||||
self.assertEqual(listing[0][1], t0.internal)
|
self.assertEqual(listing[0][1], t0.internal)
|
||||||
|
|
||||||
# content-type and metadata are updated at t1
|
# content-type and metadata are updated at t1
|
||||||
t1 = ts.next()
|
t1 = next(ts)
|
||||||
t_encoded = encode_timestamps(t0, t1, t1)
|
t_encoded = encode_timestamps(t0, t1, t1)
|
||||||
broker.put_object('obj1', t_encoded, 0, 'text/plain', 'hash1')
|
broker.put_object('obj1', t_encoded, 0, 'text/plain', 'hash1')
|
||||||
listing = broker.list_objects_iter(100, '', None, None, '')
|
listing = broker.list_objects_iter(100, '', None, None, '')
|
||||||
@ -755,10 +755,10 @@ class TestContainerBroker(unittest.TestCase):
|
|||||||
self.assertEqual(listing[0][1], t1.internal)
|
self.assertEqual(listing[0][1], t1.internal)
|
||||||
|
|
||||||
# used later
|
# used later
|
||||||
t2 = ts.next()
|
t2 = next(ts)
|
||||||
|
|
||||||
# metadata is updated at t3
|
# metadata is updated at t3
|
||||||
t3 = ts.next()
|
t3 = next(ts)
|
||||||
t_encoded = encode_timestamps(t0, t1, t3)
|
t_encoded = encode_timestamps(t0, t1, t3)
|
||||||
broker.put_object('obj1', t_encoded, 0, 'text/plain', 'hash1')
|
broker.put_object('obj1', t_encoded, 0, 'text/plain', 'hash1')
|
||||||
listing = broker.list_objects_iter(100, '', None, None, '')
|
listing = broker.list_objects_iter(100, '', None, None, '')
|
||||||
@ -775,7 +775,7 @@ class TestContainerBroker(unittest.TestCase):
|
|||||||
self.assertEqual(listing[0][1], t3.internal)
|
self.assertEqual(listing[0][1], t3.internal)
|
||||||
|
|
||||||
# all parts updated at t4, last-modified should be t4
|
# all parts updated at t4, last-modified should be t4
|
||||||
t4 = ts.next()
|
t4 = next(ts)
|
||||||
t_encoded = encode_timestamps(t4, t4, t4)
|
t_encoded = encode_timestamps(t4, t4, t4)
|
||||||
broker.put_object('obj1', t_encoded, 0, 'text/plain', 'hash1')
|
broker.put_object('obj1', t_encoded, 0, 'text/plain', 'hash1')
|
||||||
listing = broker.list_objects_iter(100, '', None, None, '')
|
listing = broker.list_objects_iter(100, '', None, None, '')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user