mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-02 11:16:07 -04:00
Clarify list/set/dict/tuple comprehensions and enforce via flake8 (#6957)
Ensure good comprehension hygiene using flake8-comprehensions.
This commit is contained in:
parent
272eee1ae1
commit
509e381afa
73 changed files with 251 additions and 276 deletions
|
@ -254,9 +254,7 @@ class StateTestCase(unittest.TestCase):
|
|||
ctx_d = context_store["D"]
|
||||
|
||||
prev_state_ids = yield ctx_d.get_prev_state_ids()
|
||||
self.assertSetEqual(
|
||||
{"START", "A", "C"}, {e_id for e_id in prev_state_ids.values()}
|
||||
)
|
||||
self.assertSetEqual({"START", "A", "C"}, set(prev_state_ids.values()))
|
||||
|
||||
self.assertEqual(ctx_c.state_group, ctx_d.state_group_before_event)
|
||||
self.assertEqual(ctx_d.state_group_before_event, ctx_d.state_group)
|
||||
|
@ -313,9 +311,7 @@ class StateTestCase(unittest.TestCase):
|
|||
ctx_e = context_store["E"]
|
||||
|
||||
prev_state_ids = yield ctx_e.get_prev_state_ids()
|
||||
self.assertSetEqual(
|
||||
{"START", "A", "B", "C"}, {e for e in prev_state_ids.values()}
|
||||
)
|
||||
self.assertSetEqual({"START", "A", "B", "C"}, set(prev_state_ids.values()))
|
||||
self.assertEqual(ctx_c.state_group, ctx_e.state_group_before_event)
|
||||
self.assertEqual(ctx_e.state_group_before_event, ctx_e.state_group)
|
||||
|
||||
|
@ -388,9 +384,7 @@ class StateTestCase(unittest.TestCase):
|
|||
ctx_d = context_store["D"]
|
||||
|
||||
prev_state_ids = yield ctx_d.get_prev_state_ids()
|
||||
self.assertSetEqual(
|
||||
{"A1", "A2", "A3", "A5", "B"}, {e for e in prev_state_ids.values()}
|
||||
)
|
||||
self.assertSetEqual({"A1", "A2", "A3", "A5", "B"}, set(prev_state_ids.values()))
|
||||
|
||||
self.assertEqual(ctx_b.state_group, ctx_d.state_group_before_event)
|
||||
self.assertEqual(ctx_d.state_group_before_event, ctx_d.state_group)
|
||||
|
@ -482,7 +476,7 @@ class StateTestCase(unittest.TestCase):
|
|||
current_state_ids = yield context.get_current_state_ids()
|
||||
|
||||
self.assertEqual(
|
||||
set([e.event_id for e in old_state]), set(current_state_ids.values())
|
||||
{e.event_id for e in old_state}, set(current_state_ids.values())
|
||||
)
|
||||
|
||||
self.assertEqual(group_name, context.state_group)
|
||||
|
@ -513,9 +507,7 @@ class StateTestCase(unittest.TestCase):
|
|||
|
||||
prev_state_ids = yield context.get_prev_state_ids()
|
||||
|
||||
self.assertEqual(
|
||||
set([e.event_id for e in old_state]), set(prev_state_ids.values())
|
||||
)
|
||||
self.assertEqual({e.event_id for e in old_state}, set(prev_state_ids.values()))
|
||||
|
||||
self.assertIsNotNone(context.state_group)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue