mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-06-25 00:10:27 -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
|
@ -67,7 +67,7 @@ class StreamChangeCacheTests(unittest.TestCase):
|
|||
# If we update an existing entity, it keeps the two existing entities
|
||||
cache.entity_has_changed("bar@baz.net", 5)
|
||||
self.assertEqual(
|
||||
set(["bar@baz.net", "user@elsewhere.org"]), set(cache._entity_to_key)
|
||||
{"bar@baz.net", "user@elsewhere.org"}, set(cache._entity_to_key)
|
||||
)
|
||||
|
||||
def test_get_all_entities_changed(self):
|
||||
|
@ -137,7 +137,7 @@ class StreamChangeCacheTests(unittest.TestCase):
|
|||
cache.get_entities_changed(
|
||||
["user@foo.com", "bar@baz.net", "user@elsewhere.org"], stream_pos=2
|
||||
),
|
||||
set(["bar@baz.net", "user@elsewhere.org"]),
|
||||
{"bar@baz.net", "user@elsewhere.org"},
|
||||
)
|
||||
|
||||
# Query all the entries mid-way through the stream, but include one
|
||||
|
@ -153,7 +153,7 @@ class StreamChangeCacheTests(unittest.TestCase):
|
|||
],
|
||||
stream_pos=2,
|
||||
),
|
||||
set(["bar@baz.net", "user@elsewhere.org"]),
|
||||
{"bar@baz.net", "user@elsewhere.org"},
|
||||
)
|
||||
|
||||
# Query all the entries, but before the first known point. We will get
|
||||
|
@ -168,21 +168,13 @@ class StreamChangeCacheTests(unittest.TestCase):
|
|||
],
|
||||
stream_pos=0,
|
||||
),
|
||||
set(
|
||||
[
|
||||
"user@foo.com",
|
||||
"bar@baz.net",
|
||||
"user@elsewhere.org",
|
||||
"not@here.website",
|
||||
]
|
||||
),
|
||||
{"user@foo.com", "bar@baz.net", "user@elsewhere.org", "not@here.website"},
|
||||
)
|
||||
|
||||
# Query a subset of the entries mid-way through the stream. We should
|
||||
# only get back the subset.
|
||||
self.assertEqual(
|
||||
cache.get_entities_changed(["bar@baz.net"], stream_pos=2),
|
||||
set(["bar@baz.net"]),
|
||||
cache.get_entities_changed(["bar@baz.net"], stream_pos=2), {"bar@baz.net"},
|
||||
)
|
||||
|
||||
def test_max_pos(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue