Skip to content

Commit

Permalink
add weight checks in test
Browse files Browse the repository at this point in the history
  • Loading branch information
GiaJordan committed Oct 10, 2023
1 parent 02b1c61 commit 8e21b6c
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions tests/test_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,10 +389,10 @@ def test_generate_edge(self, helpers, node_to_add, edge_relationship):

return

@pytest.mark.parametrize("node_to_add, expected_weight",
[("Patient ID", 1)],
@pytest.mark.parametrize("node_to_add, other_node, expected_weight",
[("Patient ID", "Patient", 0)],
ids=["list"])
def test_generate_weights(self, helpers, node_to_add, expected_weight):
def test_generate_weights(self, helpers, node_to_add, other_node, expected_weight):
# Instantiate graph object
G = nx.MultiDiGraph()

Expand Down Expand Up @@ -433,6 +433,12 @@ def test_generate_weights(self, helpers, node_to_add, expected_weight):

print(G.edges.data())

# Cast the edges and weights to a DataFrame for easier indexing
edges_and_weights = pd.DataFrame(G.edges.data(), columns= ['node1', 'node2', 'weights']).set_index('node1')

# Assert that the weight added is what is expected
assert edges_and_weights.loc[other_node, 'weights']['weight'] == expected_weight

return


Expand Down

0 comments on commit 8e21b6c

Please sign in to comment.