Code Duplication    Length = 15-18 lines in 2 locations

tests/graphinate/test_color.py 2 locations

@@ 66-83 (lines=18) @@
63
    assert not np.array_equal(color_map['u1'], color_map['p1'])  # Different types, different colors
64
65
66
def test_node_color_mapping_filters_generic_node_type():
67
    # Arrange
68
    g = nx.Graph()
69
    # The 'node' type should be ignored in color calculations if other types exist
70
    g.graph['node_types'] = {'user': {}, 'post': {}, 'node': {}}
71
    g.add_node('u1', type='user')
72
    g.add_node('p1', type='post')
73
    g.add_node('n1', type='node')  # This should get a default color
74
75
    # Act
76
    color_map = node_color_mapping(g)
77
78
    # Assert
79
    # 'user' and 'post' should have distinct colors
80
    assert not np.array_equal(color_map['u1'], color_map['p1'])
81
    # 'node' type should map to the first color in the sequence (same as 'user' in this case)
82
    # because 'user' will be at index 0 and 'post' at index 1 after filtering.
83
    assert np.array_equal(color_map['n1'], color_map['u1'])
84
85
86
def test_node_color_mapping_with_only_generic_node_type():
@@ 49-63 (lines=15) @@
46
    assert color_map == {}
47
48
49
def test_node_color_mapping_multiple_types():
50
    # Arrange
51
    g = nx.Graph()
52
    g.graph['node_types'] = {'user': {}, 'post': {}}
53
    g.add_node('u1', type='user')
54
    g.add_node('u2', type='user')
55
    g.add_node('p1', type='post')
56
57
    # Act
58
    color_map = node_color_mapping(g)
59
60
    # Assert
61
    assert len(color_map) == 3
62
    assert np.array_equal(color_map['u1'], color_map['u2'])  # Same type, same color
63
    assert not np.array_equal(color_map['u1'], color_map['p1'])  # Different types, different colors
64
65
66
def test_node_color_mapping_filters_generic_node_type():