From 57964e5da7bfc5391ede8b7862a3fbc48b89587d Mon Sep 17 00:00:00 2001 From: Dmitry Ustalov Date: Sun, 28 Jul 2024 19:28:28 +0200 Subject: [PATCH] Add test_empty --- chinese_whispers/test_chinese_whispers.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/chinese_whispers/test_chinese_whispers.py b/chinese_whispers/test_chinese_whispers.py index 8563ac4..76afc9e 100755 --- a/chinese_whispers/test_chinese_whispers.py +++ b/chinese_whispers/test_chinese_whispers.py @@ -58,6 +58,12 @@ def clustered_graph_custom_key(graph: nx.Graph[int]) -> nx.Graph[int]: return chinese_whispers(graph, seed=0, label_key=CUSTOM_KEY) +def test_empty() -> None: + graph: nx.Graph[Any] = chinese_whispers(nx.Graph(), seed=0) + + assert not graph.nodes() + + def test_return(graph: nx.Graph[int], clustered_graph: nx.Graph[int]) -> None: assert edges_equal(graph.edges, clustered_graph.edges) # type: ignore[no-untyped-call]