Skip to content

Commit

Permalink
Add a test.
Browse files Browse the repository at this point in the history
  • Loading branch information
daemontus committed Aug 24, 2024
1 parent 2bbc2db commit 03d88f9
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions tests/succession_diagram_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,13 +171,13 @@ def test_expansion_comparisons(network_file: str):
# succession_diagram is too large for this test.
return

assert sd_bfs.is_isomorphic(sd_dfs)

# Normal minimal trap space expansion.
sd_min = SuccessionDiagram(bn)
assert sd_min.expand_minimal_spaces(size_limit=NODE_LIMIT)

assert sd_bfs.is_isomorphic(sd_dfs)
assert sd_min.is_subgraph(sd_bfs)
assert sd_min.is_subgraph(sd_dfs)

# Expand the first node fully, and then expand the rest
# until minimal trap spaces are found.
Expand All @@ -188,7 +188,6 @@ def test_expansion_comparisons(network_file: str):
assert sd_min_larger.expand_minimal_spaces(node_id=node_id)

assert sd_min_larger.is_subgraph(sd_bfs)
assert sd_min_larger.is_subgraph(sd_dfs)
assert len(sd_min_larger) >= len(sd_min)

# Normal block expansion with size limit.
Expand All @@ -200,7 +199,6 @@ def test_expansion_comparisons(network_file: str):
)

assert sd_block.is_subgraph(sd_bfs)
assert sd_block.is_subgraph(sd_dfs)

block_trap = [
sd_block.node_data(i)["space"] for i in sd_block.minimal_trap_spaces()
Expand All @@ -211,6 +209,19 @@ def test_expansion_comparisons(network_file: str):
for t in min_trap:
assert t in block_trap

# Block expansion with symbolic fallback.
sd_config = SuccessionDiagram.default_config()
# Artificially enforce that NFVS method (almost) always fails.
sd_config["attractor_candidates_limit"] = 0
sd_block_fallback = SuccessionDiagram(bn)
assert sd_block_fallback.expand_block(
find_motif_avoidant_attractors=True,
size_limit=NODE_LIMIT,
optimize_source_nodes=False,
)

sd_block_fallback.is_subgraph(sd_bfs)

sd_attr = SuccessionDiagram(bn)
assert sd_attr.expand_attractor_seeds(size_limit=NODE_LIMIT)

Expand Down

1 comment on commit 03d88f9

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coverage

Coverage Report
FileStmtsMissCoverMissing
biobalm
   _pint_reachability.py615018%24, 40–54, 69–93, 101–146
   control.py1141488%107, 119, 125, 129, 134, 143–159, 477, 480, 493
   interaction_graph_utils.py52688%11–13, 151–152, 222–223
   petri_net_translation.py1491292%22–26, 79, 136, 234, 308–309, 333–334, 343, 452
   space_utils.py1322085%26–28, 104–110, 133–139, 347–350, 414, 462
   succession_diagram.py3806483%6, 120, 210–215, 228, 275–282, 386–393, 410–411, 421, 427, 543, 630–636, 752, 755, 873–891, 923, 933, 936, 976, 983, 1034, 1052, 1174, 1360, 1371, 1379, 1422, 1434, 1439, 1445
   symbolic_utils.py32584%10, 39–44, 100, 128
   trappist_core.py1842388%14–18, 55, 57, 92, 215, 217, 219, 254–256, 276–282, 340, 342, 372, 420, 422
biobalm/_sd_algorithms
   expand_attractor_seeds.py60788%6, 28, 42, 109–114, 119
   expand_bfs.py28196%6
   expand_dfs.py30197%6
   expand_minimal_spaces.py42393%6, 28, 42
   expand_source_SCCs.py1111686%11–13, 50, 69, 77, 82, 103, 112, 120, 131, 140, 143, 167, 179, 242–243
   expand_source_blocks.py1161884%10, 30, 42–45, 57, 67, 74, 79, 82, 141, 167, 176, 209, 219, 225, 234
   expand_to_target.py31390%6, 38, 43
biobalm/_sd_attractors
   attractor_candidates.py2659066%13–15, 26–27, 93, 101, 107–108, 130, 152, 187, 193–204, 223, 239–320, 325, 329, 335, 341, 356, 383, 388, 392, 398, 400–438, 511, 582–583, 684
   attractor_symbolic.py1141686%6–7, 75, 88–92, 103, 112, 144, 179, 191–193, 202, 230, 236
TOTAL199034982% 

Tests Skipped Failures Errors Time
359 0 💤 0 ❌ 0 🔥 56.567s ⏱️

Please sign in to comment.