add non-working recursive merge algorithm

This commit is contained in:
Pavel Patsey
2025-01-18 23:17:47 +03:00
parent af91a066a1
commit feda229c78
2 changed files with 80 additions and 27 deletions
+5 -17
View File
@@ -2,15 +2,19 @@ import pytest
from cidr4_merger import (
Cidr4MergerError,
answer,
cidr4_to_node,
find_neighbours_singles,
get_group_with_max_mask_len,
get_net_addr,
get_parent_ip,
have_same_parent,
lift_lonely_node,
make_cidr4,
make_groups,
make_parent,
merge_neighbors,
merge_nodes,
merge_nodes_recursion,
reduce_nodes,
sort_nodes,
)
@@ -203,19 +207,3 @@ def test_merge_nodes():
)
assert exc_info.type is Cidr4MergerError
assert str(exc_info.value) == "The top of the tree has no parent!"
def test_answer():
assert answer(
[
(0, 2, 12, 0),
(2147483648, 2, 1, 2147483648),
(3221225472, 2, 2, 2147483648),
],
2,
) == (["128.0.0.0/1", "0.0.0.0/2"], 15)
with pytest.raises(Exception) as exc_info:
answer([(0, 2, 0, 0), (2147483648, 2, 0, 2147483648)], 1)
assert exc_info.type is Cidr4MergerError
assert str(exc_info.value) == "The top of the tree has no parent!"