diff options
author | Erik Johnston <erik@matrix.org> | 2021-01-14 18:57:32 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-14 18:57:32 +0000 |
commit | 1a08e0cdab0b3475fd4189aa1e3b6f9aaa823ccf (patch) | |
tree | 8e0363d387ddf7ee01c92ee95cff12850fe6a588 /tests | |
parent | Fix perf of get_cross_signing_keys (#9116) (diff) | |
download | synapse-1a08e0cdab0b3475fd4189aa1e3b6f9aaa823ccf.tar.xz |
Fix event chain bg update. (#9118)
We passed in a graph to `sorted_topologically` which didn't have an entry for each node (as we dropped nodes with no edges).
Diffstat (limited to 'tests')
-rw-r--r-- | tests/util/test_itertools.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/util/test_itertools.py b/tests/util/test_itertools.py index 1184cea5a3..522c8061f9 100644 --- a/tests/util/test_itertools.py +++ b/tests/util/test_itertools.py @@ -56,6 +56,14 @@ class SortTopologically(TestCase): graph = {} # type: Dict[int, List[int]] self.assertEqual(list(sorted_topologically([], graph)), []) + def test_handle_empty_graph(self): + "Test that a graph where a node doesn't have an entry is treated as empty" + + graph = {} # type: Dict[int, List[int]] + + # For disconnected nodes the output is simply sorted. + self.assertEqual(list(sorted_topologically([1, 2], graph)), [1, 2]) + def test_disconnected(self): "Test that a graph with no edges work" |