summary refs log tree commit diff
path: root/tests/util/test_itertools.py
diff options
context:
space:
mode:
authorAndrew Morgan <andrew@amorgan.xyz>2021-04-22 16:22:50 +0100
committerAndrew Morgan <andrew@amorgan.xyz>2021-04-22 16:22:50 +0100
commit3f8b6e509170495b55c595aee327b2e43a76ee79 (patch)
tree706d0823ea77781e514d3d79f88edd2bdefa5921 /tests/util/test_itertools.py
parentMerge commit '631dd06f2' into anoa/dinsic_release_1_31_0 (diff)
parentAdd some extra notes for getting Synapse running on macOS. (#8997) (diff)
downloadsynapse-3f8b6e509170495b55c595aee327b2e43a76ee79.tar.xz
Merge commit '20af31088' into anoa/dinsic_release_1_31_0
Diffstat (limited to 'tests/util/test_itertools.py')
-rw-r--r--tests/util/test_itertools.py8
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"