add fixtures for nodes and groups

This commit is contained in:
Pavel Patsey
2025-01-19 00:05:21 +03:00
parent 95fbdff75f
commit 58c2b5cbe0
+49 -17
View File
@@ -230,15 +230,54 @@ def test_make_groups():
}
def test_find_neighbours_singles():
nodes_with_neighbours = [
@pytest.fixture
def nodes_only_neighbours():
return [
(0, 2, 12, 0),
(1073741824, 2, 3, 0),
(2147483648, 2, 1, 2147483648),
(3221225472, 2, 2, 2147483648),
]
groups_with_neighbours = make_groups(nodes_with_neighbours)
assert find_neighbours_singles(groups_with_neighbours) == (
@pytest.fixture
def nodes_only_singles():
return [
(0, 2, 12, 0),
(2147483648, 2, 1, 2147483648),
]
@pytest.fixture
def nodes_with_neighbours_n_singles():
return [
(0, 2, 12, 0),
(1073741824, 2, 3, 0),
(2147483648, 2, 1, 2147483648),
]
@pytest.fixture
def groups_only_neighbours(nodes_only_neighbours):
return make_groups(nodes_only_neighbours)
@pytest.fixture
def groups_only_singles(nodes_only_singles):
return make_groups(nodes_only_singles)
@pytest.fixture
def groups_with_neighbours_n_singles(nodes_with_neighbours_n_singles):
return make_groups(nodes_with_neighbours_n_singles)
def test_find_neighbours_singles(
groups_only_neighbours,
groups_only_singles,
groups_with_neighbours_n_singles,
):
assert find_neighbours_singles(groups_only_neighbours) == (
[
((0, 2, 12, 0), (1073741824, 2, 3, 0)),
((2147483648, 2, 1, 2147483648), (3221225472, 2, 2, 2147483648)),
@@ -246,28 +285,21 @@ def test_find_neighbours_singles():
[],
)
nodes_with_singles = [
(0, 2, 12, 0),
(2147483648, 2, 1, 2147483648),
]
groups_with_singles = make_groups(nodes_with_singles)
assert find_neighbours_singles(groups_with_singles) == (
assert find_neighbours_singles(groups_only_singles) == (
[],
[(0, 2, 12, 0), (2147483648, 2, 1, 2147483648)],
)
nodes_with_neighbours_n_singles = [
(0, 2, 12, 0),
(1073741824, 2, 3, 0),
(2147483648, 2, 1, 2147483648),
]
groups_with_singles = make_groups(nodes_with_neighbours_n_singles)
assert find_neighbours_singles(groups_with_singles) == (
assert find_neighbours_singles(groups_with_neighbours_n_singles) == (
[((0, 2, 12, 0), (1073741824, 2, 3, 0))],
[(2147483648, 2, 1, 2147483648)],
)
def test_merge_neighbors():
assert True
# def test_merge_nodes_recursion():
# assert merge_nodes(
# [