Skip to content

Commit

Permalink
fix tests and mypy errors
Browse files Browse the repository at this point in the history
  • Loading branch information
LegrandNico committed Dec 20, 2024
1 parent 39db61c commit a97a4ea
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions pyhgf/utils/add_parent.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from typing import Dict, Tuple

from pyhgf.typing import AdjacencyLists, Edges
from pyhgf.utils import add_edges
from pyhgf.utils.add_edges import add_edges


def add_parent(
Expand All @@ -21,7 +21,7 @@ def add_parent(
The index of the node you want to connect a new parent node to.
coupling_type :
The type of coupling you want between the existing node and it's new parent.
Can be either "value" or "volatility".
Can be either `"value"` or `"volatility"`.
mean :
The mean value of the new parent node.
Expand Down
9 changes: 6 additions & 3 deletions tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def test_set_update_sequence():
assert len(predictions) == 1
assert len(updates) == 3


def test_add_parent():
"""Test the add_parent function."""
network = (
Expand All @@ -101,16 +102,18 @@ def test_add_parent():
.add_nodes(value_children=2)
.add_nodes(value_children=3)
)
attributes, edges, _ = network.get_network()
new_attributes, new_edges = add_parent(attributes, edges, 1, "volatility", 1.0)

assert len(new_attributes) == 8
assert len(new_edges) == 7

new_attributes, new_edges = add_parent(attributes, edges, 1, "value", 1.0)

assert len(new_attributes) == 9
assert len(new_edges) == 8

assert len(new_attributes) == 8
assert len(new_edges) == 7


def test_remove_node():
"""Test the remove_node function."""
network = (
Expand Down

0 comments on commit a97a4ea

Please sign in to comment.