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 29, 2024
1 parent b4f3fae commit 7b10ab1
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tests/succession_diagram_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import biobalm.succession_diagram
from biobalm.succession_diagram import SuccessionDiagram
from biobalm.types import BooleanSpace
from biobalm._sd_attractors.attractor_symbolic import symbolic_attractor_fallback


class SuccessionDiagramTest(unittest.TestCase):
Expand Down Expand Up @@ -171,13 +172,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 +189,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 +200,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 +210,15 @@ 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()
sd_fallback = SuccessionDiagram(bn, sd_config)
assert sd_fallback.expand_bfs()
for n in sd_fallback.node_ids():
symbolic = symbolic_attractor_fallback(sd_fallback, n)
normal = sd_fallback.node_attractor_seeds(n, compute=True)
assert len(normal) == len(symbolic[0])

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

Expand Down

1 comment on commit 7b10ab1

@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.py3917481%6, 123, 213–218, 231, 278–285, 389–396, 413–414, 424, 430, 546, 633–639, 755, 758, 853–867, 898–916, 948, 958, 961, 1001, 1008, 1059, 1077, 1199, 1385, 1396, 1404, 1447, 1459, 1464, 1470
   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.py1212083%10, 30, 42–45, 57, 67, 74, 79, 82, 141, 167, 176, 210–211, 215, 225, 231, 240
   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.py1593280%6–7, 37–38, 56, 65–81, 84, 89, 170, 183–187, 198, 207, 239, 274, 286–288, 297, 325, 331
TOTAL205137782% 

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

Please sign in to comment.