diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-03-29 12:15:33 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-29 12:15:33 -0400 |
commit | 01dd90b0f08d1ffb36eb24282edc5db62a21170f (patch) | |
tree | e1b2983708614d3be8f70d79f480dae81d591c97 /tests | |
parent | Clarify that register_new_matrix_user is present also when installed via non-... (diff) | |
download | synapse-01dd90b0f08d1ffb36eb24282edc5db62a21170f.tar.xz |
Add type hints to DictionaryCache and TTLCache. (#9442)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/storage/test_state.py | 22 | ||||
-rw-r--r-- | tests/util/test_dict_cache.py | 4 |
2 files changed, 11 insertions, 15 deletions
diff --git a/tests/storage/test_state.py b/tests/storage/test_state.py index 8bd12fa847..2471f1267d 100644 --- a/tests/storage/test_state.py +++ b/tests/storage/test_state.py @@ -377,14 +377,11 @@ class StateStoreTestCase(tests.unittest.TestCase): ####################################################### # deliberately remove e2 (room name) from the _state_group_cache - ( - is_all, - known_absent, - state_dict_ids, - ) = self.state_datastore._state_group_cache.get(group) + cache_entry = self.state_datastore._state_group_cache.get(group) + state_dict_ids = cache_entry.value - self.assertEqual(is_all, True) - self.assertEqual(known_absent, set()) + self.assertEqual(cache_entry.full, True) + self.assertEqual(cache_entry.known_absent, set()) self.assertDictEqual( state_dict_ids, { @@ -403,14 +400,11 @@ class StateStoreTestCase(tests.unittest.TestCase): fetched_keys=((e1.type, e1.state_key),), ) - ( - is_all, - known_absent, - state_dict_ids, - ) = self.state_datastore._state_group_cache.get(group) + cache_entry = self.state_datastore._state_group_cache.get(group) + state_dict_ids = cache_entry.value - self.assertEqual(is_all, False) - self.assertEqual(known_absent, {(e1.type, e1.state_key)}) + self.assertEqual(cache_entry.full, False) + self.assertEqual(cache_entry.known_absent, {(e1.type, e1.state_key)}) self.assertDictEqual(state_dict_ids, {(e1.type, e1.state_key): e1.event_id}) ############################################ diff --git a/tests/util/test_dict_cache.py b/tests/util/test_dict_cache.py index 34fdc9a43a..2f41333f4c 100644 --- a/tests/util/test_dict_cache.py +++ b/tests/util/test_dict_cache.py @@ -27,7 +27,9 @@ class DictCacheTestCase(unittest.TestCase): key = "test_simple_cache_hit_full" v = self.cache.get(key) - self.assertEqual((False, set(), {}), v) + self.assertIs(v.full, False) + self.assertEqual(v.known_absent, set()) + self.assertEqual({}, v.value) seq = self.cache.sequence test_value = {"test": "test_simple_cache_hit_full"} |