diff --git a/tests/fba/algorithm/test_fba.py b/tests/fba/algorithm/test_fba.py index fcfe4b7..47636b3 100644 --- a/tests/fba/algorithm/test_fba.py +++ b/tests/fba/algorithm/test_fba.py @@ -37,7 +37,7 @@ def test_rank_to_partition_idx(rank, expected): ), ) def test_build_block_counterimage(graph, counterimaged_block_indexes): - vertexes, _ = prepare_graph(graph) + vertexes = prepare_graph(graph) counterimaged_block = _Block( map(lambda idx: vertexes[idx], counterimaged_block_indexes), None ) @@ -59,35 +59,16 @@ def test_build_block_counterimage(graph, counterimaged_block_indexes): ) -@pytest.mark.parametrize( - "graph", - test_cases.graphs, -) -def test_prepare_graph_max_rank(graph): - _, max_rank = prepare_graph(graph) - assert max_rank == max( - map(lambda node: graph.nodes[node]["rank"], graph.nodes) - ) - - @pytest.mark.parametrize( "graph", test_cases.graphs, ) def test_prepare_graph_vertexes(graph): - vertexes, _ = prepare_graph(graph) + vertexes = prepare_graph(graph) # same length assert len(vertexes) == len(graph.nodes) - # same rank - assert all( - map( - lambda idx: vertexes[idx].rank == graph.nodes[idx]["rank"], - range(len(vertexes)), - ) - ) - # counterimage my_counterimage = [ map(attrgetter("label"), vertex.counterimage) for vertex in vertexes @@ -101,7 +82,8 @@ def test_prepare_graph_vertexes(graph): @pytest.mark.parametrize("graph", test_cases.graphs) def test_create_initial_partition(graph): - vertexes, max_rank = prepare_graph(graph) + vertexes = prepare_graph(graph) + max_rank = max(vertex.rank for vertex in vertexes) partition = create_initial_partition(vertexes, max_rank) # at most one block per rank @@ -122,7 +104,8 @@ def test_create_initial_partition(graph): @pytest.mark.parametrize("graph", test_cases.graphs) def test_split_upper_ranks(graph): - vertexes, max_rank = prepare_graph(graph) + vertexes = prepare_graph(graph) + max_rank = max(vertex.rank for vertex in vertexes) partition_length = 0 if max_rank == float("-inf") else max_rank + 2 for idx in range(partition_length): diff --git a/tests/fba/test_fba_rscp_utilities.py b/tests/fba/test_fba_rscp_utilities.py index f548c98..57095fd 100644 --- a/tests/fba/test_fba_rscp_utilities.py +++ b/tests/fba/test_fba_rscp_utilities.py @@ -15,7 +15,7 @@ def build_test_blocks(graph, partition, expected): # this is needed to avoid an error for node in graph.nodes: graph.nodes[node]["rank"] = 0 - (vertexes, _) = to_normal_graph(graph) + vertexes = to_normal_graph(graph) return ( _Block([vertexes[idx] for idx in partition[0]], None), _Block([vertexes[idx] for idx in partition[1]], None),