Skip to content

Commit

Permalink
test: Add unit test for subgraph cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasyager committed Jul 1, 2023
1 parent c96c545 commit b0cb70e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/unit/test_resource_grouper_classification.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,19 @@ def example_graph(self):
graph.add_edges_from([("a", "b"), ("b", "c"), ("b", "d"), ("d", "1")])
return graph

@pytest.fixture
def example_graph_with_tests(self):
graph = networkx.DiGraph()
graph.add_edges_from(
[
("source.a", "model.b"),
("model.b", "test.c"),
("model.b", "model.d"),
("model.d", "test.1"),
]
)
return graph

def test_resource_grouper_boundary_classification(self, example_graph):
nodes = {"a", "b", "c", "d"}
resources = ResourceGrouper.classify_resource_access(example_graph, nodes)
Expand All @@ -22,3 +35,7 @@ def test_resource_grouper_boundary_classification(self, example_graph):
"c": AccessType.Public,
"d": AccessType.Public,
}

def test_clean_graph_removes_test_nodes(self, example_graph_with_tests):
output_graph = ResourceGrouper.clean_subgraph(example_graph_with_tests)
assert set(output_graph.nodes) == {"source.a", "model.b", "model.d"}

0 comments on commit b0cb70e

Please sign in to comment.