Merge "Fix using filter() to meet python2,3"

This commit is contained in:
Jenkins 2016-09-28 22:25:57 +00:00 committed by Gerrit Code Review
commit 8526d4c5d2
2 changed files with 7 additions and 7 deletions

View File

@ -795,8 +795,8 @@ class TestContainerBroker(unittest.TestCase):
if isinstance(self, ContainerBrokerMigrationMixin): if isinstance(self, ContainerBrokerMigrationMixin):
real_storage_policy_index = \ real_storage_policy_index = \
broker.get_info()['storage_policy_index'] broker.get_info()['storage_policy_index']
policy = filter(lambda p: p.idx == real_storage_policy_index, policy = [p for p in POLICIES
POLICIES)[0] if p.idx == real_storage_policy_index][0]
broker.put_object('correct_o', next(ts), 123, 'text/plain', broker.put_object('correct_o', next(ts), 123, 'text/plain',
'5af83e3196bf99f440f31f2e1a6c9afe', '5af83e3196bf99f440f31f2e1a6c9afe',
storage_policy_index=policy.idx) storage_policy_index=policy.idx)
@ -823,8 +823,8 @@ class TestContainerBroker(unittest.TestCase):
if isinstance(self, ContainerBrokerMigrationMixin): if isinstance(self, ContainerBrokerMigrationMixin):
real_storage_policy_index = \ real_storage_policy_index = \
broker.get_info()['storage_policy_index'] broker.get_info()['storage_policy_index']
policy = filter(lambda p: p.idx == real_storage_policy_index, policy = [p for p in POLICIES
POLICIES)[0] if p.idx == real_storage_policy_index][0]
broker.put_object('correct_o', next(ts), 123, 'text/plain', broker.put_object('correct_o', next(ts), 123, 'text/plain',
'5af83e3196bf99f440f31f2e1a6c9afe', '5af83e3196bf99f440f31f2e1a6c9afe',
storage_policy_index=policy.idx) storage_policy_index=policy.idx)
@ -847,8 +847,8 @@ class TestContainerBroker(unittest.TestCase):
if isinstance(self, ContainerBrokerMigrationMixin): if isinstance(self, ContainerBrokerMigrationMixin):
real_storage_policy_index = \ real_storage_policy_index = \
broker.get_info()['storage_policy_index'] broker.get_info()['storage_policy_index']
policy = filter(lambda p: p.idx == real_storage_policy_index, policy = [p for p in POLICIES
POLICIES)[0] if p.idx == real_storage_policy_index][0]
policy_stats = broker.get_policy_stats() policy_stats = broker.get_policy_stats()
expected = {policy.idx: {'bytes_used': 0, 'object_count': 0}} expected = {policy.idx: {'bytes_used': 0, 'object_count': 0}}
self.assertEqual(policy_stats, expected) self.assertEqual(policy_stats, expected)

View File

@ -4949,7 +4949,7 @@ class TestObjectController(unittest.TestCase):
expected) expected)
# check that no coro was left waiting to write # check that no coro was left waiting to write
self.assertTrue(timeouts) # sanity - WrappedTimeout did get called self.assertTrue(timeouts) # sanity - WrappedTimeout did get called
missing_exits = filter(lambda tb: tb is not None, timeouts.values()) missing_exits = [tb for tb in timeouts.values() if tb is not None]
self.assertFalse( self.assertFalse(
missing_exits, 'Failed to exit all ChunkWriteTimeouts.\n' + missing_exits, 'Failed to exit all ChunkWriteTimeouts.\n' +
''.join(['No exit from ChunkWriteTimeout entered at:\n' + ''.join(['No exit from ChunkWriteTimeout entered at:\n' +