Skip to content

Commit

Permalink
update tests since now we can deterministically predict the output ma…
Browse files Browse the repository at this point in the history
…pping
  • Loading branch information
georgios-ts committed Jul 15, 2021
1 parent 8f3c701 commit e39dcbe
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 42 deletions.
18 changes: 3 additions & 15 deletions tests/digraph/test_isomorphic.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,11 +259,7 @@ def test_digraph_vf2_mapping_identical_vf2pp(self):
mapping = retworkx.digraph_vf2_mapping(
graph, second_graph, id_order=False
)
valid_mappings = [
{0: 0, 1: 1, 2: 2, 3: 3},
{0: 0, 1: 2, 2: 1, 3: 3},
]
self.assertIn(next(mapping), valid_mappings)
self.assertEqual(next(mapping), {0: 0, 1: 1, 2: 2, 3: 3})

def test_graph_vf2_mapping_identical_removals_vf2pp(self):
graph = retworkx.generators.directed_path_graph(2)
Expand Down Expand Up @@ -291,11 +287,7 @@ def test_subgraph_vf2_mapping_vf2pp(self):
mapping = retworkx.digraph_vf2_mapping(
graph, second_graph, subgraph=True, id_order=False
)
valid_mappings = [
{8: 3, 5: 2, 7: 1, 4: 0},
{7: 2, 5: 1, 4: 0, 8: 3},
]
self.assertIn(next(mapping), valid_mappings)
self.assertEqual(next(mapping), {4: 0, 5: 1, 7: 2, 8: 3})

def test_vf2pp_remapping(self):
temp = retworkx.generators.directed_grid_graph(3, 3)
Expand All @@ -310,8 +302,4 @@ def test_vf2pp_remapping(self):
mapping = retworkx.digraph_vf2_mapping(
graph, second_graph, subgraph=True, id_order=False
)
expected_mappings = [
{6: 1, 5: 0, 8: 2, 9: 3},
{6: 2, 5: 0, 9: 3, 8: 1},
]
self.assertIn(next(mapping), expected_mappings)
self.assertEqual(next(mapping), {5: 0, 6: 1, 8: 2, 9: 3})
30 changes: 3 additions & 27 deletions tests/graph/test_isomorphic.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,11 +266,7 @@ def test_graph_vf2_mapping_identical_vf2pp(self):
mapping = retworkx.graph_vf2_mapping(
graph, second_graph, id_order=False
)
valid_mappings = [
{0: 0, 1: 1, 2: 2, 3: 3},
{0: 0, 1: 2, 2: 1, 3: 3},
]
self.assertIn(next(mapping), valid_mappings)
self.assertEqual(next(mapping), {0: 0, 1: 1, 2: 2, 3: 3})

def test_graph_vf2_mapping_identical_removals_vf2pp(self):
graph = retworkx.generators.path_graph(2)
Expand Down Expand Up @@ -298,17 +294,7 @@ def test_subgraph_vf2_mapping_vf2pp(self):
mapping = retworkx.graph_vf2_mapping(
graph, second_graph, subgraph=True, id_order=False
)
valid_mappings = [
{3: 2, 4: 3, 6: 0, 7: 1},
{3: 1, 4: 3, 6: 0, 7: 2},
{4: 3, 5: 1, 7: 2, 8: 0},
{0: 0, 1: 1, 3: 2, 4: 3},
{7: 1, 8: 0, 4: 3, 5: 2},
{5: 1, 2: 0, 1: 2, 4: 3},
{3: 1, 0: 0, 4: 3, 1: 2},
{1: 1, 2: 0, 4: 3, 5: 2},
]
self.assertIn(next(mapping), valid_mappings)
self.assertEqual(next(mapping), {4: 0, 3: 2, 0: 3, 1: 1})

def test_vf2pp_remapping(self):
temp = retworkx.generators.grid_graph(3, 3)
Expand All @@ -323,14 +309,4 @@ def test_vf2pp_remapping(self):
mapping = retworkx.graph_vf2_mapping(
graph, second_graph, subgraph=True, id_order=False
)
expected_mappings = [
{2: 2, 3: 0, 5: 3, 6: 1},
{5: 3, 6: 1, 8: 2, 9: 0},
{2: 1, 5: 3, 6: 2, 3: 0},
{2: 2, 1: 0, 5: 3, 4: 1},
{5: 3, 6: 2, 8: 1, 9: 0},
{4: 2, 1: 0, 5: 3, 2: 1},
{5: 3, 8: 1, 4: 2, 7: 0},
{5: 3, 4: 1, 7: 0, 8: 2},
]
self.assertIn(next(mapping), expected_mappings)
self.assertEqual(next(mapping), {5: 0, 4: 2, 1: 3, 2: 1})

0 comments on commit e39dcbe

Please sign in to comment.