Remove some unnecessary list comprehensions

Just use list() instead. Noticed while looking at something else.

Trivialfix

Change-Id: I906a13ef6c2f5426a1ac7c4ae24dbf168a0f371a
This commit is contained in:
Brian Haley 2022-10-05 17:01:11 -04:00
parent 5463b6b987
commit 3d0f1ef4fa
4 changed files with 4 additions and 4 deletions

View File

@ -100,7 +100,7 @@ class TestExclusiveResourceProcessor(base.BaseTestCase):
for update in not_primary.updates():
raise Exception("Only the primary should process a resource")
self.assertEqual(2, len([i for i in primary.updates()]))
self.assertEqual(2, len(list(primary.updates())))
def test_hit_retry_limit(self):
tries = 1

View File

@ -4066,7 +4066,7 @@ class L3AgentDbTestCaseBase(L3NatTestCaseMixin):
with mock.patch(l3_rpc_agent_api_str):
plugin = directory.get_plugin(plugin_constants.L3)
notifyApi = plugin.l3_rpc_notifier
kargs = [item for item in args]
kargs = list(args)
kargs.append(notifyApi)
target_func(*kargs)

View File

@ -206,7 +206,7 @@ class SubnetpoolPrefixOpsTestBase(object):
subnetpool = subnetpool_obj.SubnetPool.get_object(
self.context,
id=subnetpool_id)
current_prefix_set = netaddr.IPSet([x for x in subnetpool.prefixes])
current_prefix_set = netaddr.IPSet(list(subnetpool.prefixes))
expected_prefix_set = netaddr.IPSet(expected_prefixes)
excluded_prefix_set = netaddr.IPSet(excluded_prefixes)
self.assertTrue(expected_prefix_set.issubset(current_prefix_set))

View File

@ -528,7 +528,7 @@ class TestNetworksFailover(TestDhcpSchedulerBaseTestCase,
with mock.patch.object(self, 'agent_starting_up',
side_effect=[True, False]):
res = [b for b in self._filter_bindings(None, bindings_objs)]
res = list(self._filter_bindings(None, bindings_objs))
# once per each agent id1 and id2
self.assertEqual(2, len(res))
res_ids = [b.network_id for b in res]