Skip to content

Commit e1fcfbc

Browse files
added edge case in ReactionSystem
Signed-off-by: sivasathyaseeelan <[email protected]>
1 parent 4754287 commit e1fcfbc

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

test/reactionsystem_core/reactionsystem.jl

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -612,6 +612,31 @@ let
612612
@test_throws Exception rs = ReactionSystem([Reaction(k1, [X1], [])], t, [X1, x], [k1])
613613
end
614614

615+
# Test for forbidden symbols
616+
let
617+
# Define the forbidden symbols (mocked for the purpose of the test)
618+
forbidden_symbols_error = Set([:forbidden1, :forbidden2, :forbidden3])
619+
Catalyst.forbidden_symbols_error = forbidden_symbols_error
620+
621+
# Define parameters and species including forbidden symbols
622+
@parameters p1 forbidden1
623+
@species S1 forbidden2(t)
624+
625+
# Define reactions using the species and parameters
626+
rxs = [
627+
Reaction(p1, [], [S1]),
628+
Reaction(forbidden1, [], [S1]),
629+
]
630+
631+
# Attempt to create a ReactionSystem and capture the error
632+
try
633+
@named rs = ReactionSystem(rxs, t)
634+
@test false # This line should not be reached
635+
catch e
636+
@test e isa Exception
637+
end
638+
end
639+
615640
# Tests various erroneous `convert` calls.
616641
let
617642
# Conversion of non-autonomous `ReactionSystem` to `NonlinearSystem`.

0 commit comments

Comments
 (0)