Skip to content

Commit dbce2fa

Browse files
authored
Merge pull request #930 from SciML/record_broken_tests
[v14 - Ready] Go through broken tests
2 parents 151d00f + 8ef7273 commit dbce2fa

File tree

9 files changed

+52
-57
lines changed

9 files changed

+52
-57
lines changed

Diff for: test/dsl/dsl_options.jl

+2-2
Original file line numberDiff line numberDiff line change
@@ -488,12 +488,12 @@ let
488488
@test sol[:Y][end] 3.0
489489

490490
# Tests that observables can be used for plot indexing.
491-
@test_broken false # plot(sol; idxs=X).series_list[1].plotattributes[:y][end] ≈ 10.0
491+
plot(sol; idxs=X).series_list[1].plotattributes[:y][end] 10.0
492492
@test plot(sol; idxs=rn.X).series_list[1].plotattributes[:y][end] 10.0
493493
@test plot(sol; idxs=:X).series_list[1].plotattributes[:y][end] 10.0
494494
@test plot(sol; idxs=[X, Y]).series_list[2].plotattributes[:y][end] 3.0
495495
@test plot(sol; idxs=[rn.X, rn.Y]).series_list[2].plotattributes[:y][end] 3.0
496-
@test_broken false # plot(sol; idxs=[:X, :Y]).series_list[2].plotattributes[:y][end] ≈ 3.0
496+
@test_broken plot(sol; idxs=[:X, :Y]).series_list[2].plotattributes[:y][end] 3.0 # (https://github.com/SciML/ModelingToolkit.jl/issues/2778)
497497
end
498498

499499
# Compares programmatic and DSL system with observables.

Diff for: test/reactionsystem_core/coupled_equation_crn_systems.jl

+7-10
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ end
293293
# Checks for both differential and algebraic equations.
294294
# Checks for problems, integrators, and solutions yielded by coupled systems.
295295
# Checks that metadata, types, and default values are carried through correctly.
296-
@test_broken let # SDEs are currently broken with structural simplify.
296+
@test_broken let # SDEs are currently broken with structural simplify (https://github.com/SciML/ModelingToolkit.jl/issues/2614).
297297
# Creates the model
298298
@parameters a1 [description="Parameter a1"] a2::Rational{Int64} a3=0.3 a4::Rational{Int64}=4//10 [description="Parameter a4"]
299299
@parameters b1 [description="Parameter b1"] b2::Int64 b3 = 3 b4::Int64=4 [description="Parameter b4"]
@@ -557,15 +557,12 @@ let
557557
@test osol[B][end] 1.0
558558

559559
# Checks that SteadyState simulation of the system achieves the correct steady state.
560-
# Currently broken due to MTK.
561-
@test_broken begin
562-
ssprob = SteadyStateProblem(coupled_rs, u0, ps; structural_simplify = true)
563-
sssol = solve(oprob, DynamicSS(Vern7()); abstol = 1e-8, reltol = 1e-8)
564-
@test osol[X][end] 2.0
565-
@test osol[A][end] 0.0 atol = 1e-8
566-
@test osol[D(A)][end] 0.0 atol = 1e-8
567-
@test osol[B][end] 1.0
568-
end
560+
ssprob = SteadyStateProblem(coupled_rs, u0, ps; structural_simplify = true)
561+
sssol = solve(ssprob, DynamicSS(Vern7()); abstol = 1e-8, reltol = 1e-8)
562+
@test sssol[X][end] 2.0
563+
@test sssol[A][end] 0.0 atol = 1e-8
564+
@test sssol[D(A)][end] 0.0 atol = 1e-8
565+
@test sssol[B][end] 1.0
569566

570567
# Checks that the steady state can be found by solving a nonlinear problem.
571568
# Here `B => 0.1` has to be provided as well (and it shouldn't for the 2nd order ODE), hence the

Diff for: test/reactionsystem_core/events.jl

+7-6
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ let
158158
]
159159

160160
# Declares various misformatted events .
161-
# Relevant MTK issue regarding misformatted events not throwing an early error https://github.com/SciML/ModelingToolkit.jl/issues/2612.
161+
@test_broken false # Some misformatted tests should throw error at this stage, but does not (https://github.com/SciML/ModelingToolkit.jl/issues/2612).
162162
continuous_events_bad = [
163163
X ~ 1.0 => [X ~ 0.5], # Scalar condition.
164164
[X ~ 1.0] => X ~ 0.5, # Scalar affect.
@@ -362,9 +362,9 @@ let
362362
sol = solve(jprob, SSAStepper(); seed)
363363

364364
# Checks that all `e` parameters have been updated properly.
365-
# Note that periodic discrete events are currently broken for jump processes.
365+
# Note that periodic discrete events are currently broken for jump processes (and unlikely to be fixed soon due to periodic callbacks using the internals of ODE integrator and Datastructures heap implementations).
366366
@test sol.ps[:e1] == 1
367-
@test_broken sol.ps[:e2] == 1
367+
@test_broken sol.ps[:e2] == 1 # (https://github.com/SciML/JumpProcesses.jl/issues/417)
368368
@test sol.ps[:e3] == 1
369369
end
370370

@@ -424,21 +424,22 @@ let
424424
osol_events = solve(oprob_events, Tsit5())
425425
@test osol == osol_events
426426

427-
# Checks for SDE simulations.
427+
# Checks for SDE simulations (note, non-seed dependant test should be created instead).
428428
sprob = SDEProblem(rn, u0, tspan, ps)
429429
sprob_events = SDEProblem(rn_events, u0, tspan, ps)
430430
ssol = solve(sprob, ImplicitEM(); seed, callback)
431431
ssol_events = solve(sprob_events, ImplicitEM(); seed)
432432
@test ssol == ssol_events
433433

434-
# Checks for Jump simulations.
434+
# Checks for Jump simulations. (note, non-seed dependant test should be created instead)
435+
# Note that periodic discrete events are currently broken for jump processes (and unlikely to be fixed soon due to have events are implemented).
435436
callback = CallbackSet(cb_disc_1, cb_disc_2, cb_disc_3)
436437
dprob = DiscreteProblem(rn, u0, tspan, ps)
437438
dprob_events = DiscreteProblem(rn_dics_events, u0, tspan, ps)
438439
jprob = JumpProblem(rn, dprob, Direct(); rng)
439440
jprob_events = JumpProblem(rn_dics_events, dprob_events, Direct(); rng)
440441
sol = solve(jprob, SSAStepper(); seed, callback)
441-
@test_broken let # Broken due to. Even if fixed, seeding might not work due to events.
442+
@test_broken let # (https://github.com/SciML/JumpProcesses.jl/issues/417)
442443
sol_events = solve(jprob_events, SSAStepper(); seed)
443444
@test sol == sol_events
444445
end

Diff for: test/reactionsystem_core/parameter_type_designation.jl

+3-9
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ let
8888
nsol = solve(nprob, NewtonRaphson())
8989

9090
# Checks all stored parameters.
91-
for mtk_struct in [oprob, sprob, dprob, jprob, nprob, oinit, sinit, jinit, osol, ssol, jsol, nsol]
91+
for mtk_struct in [oprob, sprob, dprob, jprob, nprob, oinit, sinit, jinit, ninit, osol, ssol, jsol, nsol]
9292
# Checks that all parameters have the correct type.
9393
@test unwrap(mtk_struct.ps[p1]) isa Float64
9494
@test unwrap(mtk_struct.ps[d1]) isa Float64
@@ -114,8 +114,8 @@ let
114114
@test unwrap(mtk_struct.ps[d5]) == Float32(1.5)
115115
end
116116

117-
# Checks all stored variables.
118-
for mtk_struct in [oprob, sprob, dprob, jprob, nprob, oinit, sinit, jinit]
117+
# Checks all stored variables (these should always be `Float64`).
118+
for mtk_struct in [oprob, sprob, dprob, jprob, nprob, oinit, sinit, jinit, ninit]
119119
# Checks that all variables have the correct type.
120120
@test unwrap(mtk_struct[X1]) isa Float64
121121
@test unwrap(mtk_struct[X2]) isa Float64
@@ -130,10 +130,4 @@ let
130130
@test unwrap(mtk_struct[X4]) == 0.4
131131
@test unwrap(mtk_struct[X5]) == 0.5
132132
end
133-
134-
# This test started working now, probably due to a MTK fix. Need to look at where to put it
135-
# back into the test properly though.
136-
@test_broken false
137-
# Indexing currently broken for NonlinearSystem integrators (MTK intend to support this though).
138-
@test unwrap(ninit.ps[p1]) isa Float64
139133
end

Diff for: test/reactionsystem_core/reactionsystem.jl

+1-1
Original file line numberDiff line numberDiff line change
@@ -750,5 +750,5 @@ end
750750
# there are several places in the code where the `reactionsystem_uptodate` function is called, here
751751
# the code might need adaptation to take the updated reaction system into account.
752752
let
753-
@test_nowarn Catalyst.reactionsystem_uptodate_check()
753+
@test_nowarn Catalyst.reactionsystem_uptodate_check()
754754
end

Diff for: test/simulation_and_solving/simulate_SDEs.jl

+4-3
Original file line numberDiff line numberDiff line change
@@ -224,13 +224,14 @@ let
224224
@species X1(t) X2(t)
225225
p_syms = @parameters $(η_stored) k1 k2
226226

227-
r1 = Reaction(k1,[X1],[X2],[1],[1]; metadata = [:noise_scaling => η_stored])
228-
r2 = Reaction(k2,[X2],[X1],[1],[1]; metadata = [:noise_scaling => η_stored])
227+
r1 = Reaction(k1, [X1], [X2], [1], [1]; metadata = [:noise_scaling => p_syms[1]])
228+
r2 = Reaction(k2, [X2], [X1], [1], [1]; metadata = [:noise_scaling => p_syms[1]])
229229
@named noise_scaling_network = ReactionSystem([r1, r2], t, [X1, X2], [k1, k2, p_syms[1]])
230+
noise_scaling_network = complete(noise_scaling_network)
230231

231232
u0 = [:X1 => 1100.0, :X2 => 3900.0]
232233
p = [:k1 => 2.0, :k2 => 0.5, => 0.0]
233-
@test_broken SDEProblem(noise_scaling_network, u0, (0.0, 1000.0), p).ps[] == 0.0 # Broken due to SII/MTK stuff.
234+
@test SDEProblem(noise_scaling_network, u0, (0.0, 1000.0), p).ps[] == 0.0
234235
end
235236

236237
# Complicated test with many combinations of options.

Diff for: test/spatial_modelling/lattice_reaction_systems.jl

+1
Original file line numberDiff line numberDiff line change
@@ -280,6 +280,7 @@ end
280280
# Currently not supported. Won't be until the LatticeReactionSystem internal update is merged.
281281

282282
# Checks that parameter types designated in the non-spatial `ReactionSystem` is handled correctly.
283+
# Broken lattice tests have local branches that fixes them.
283284
@test_broken let
284285
# Declares LatticeReactionSystem with designated parameter types.
285286
rs = @reaction_network begin

Diff for: test/upstream/mtk_problem_inputs.jl

+12-7
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,11 @@ let
172172
@species X3(t)
173173
@parameters k3
174174

175+
# Creates systems (so these are not recreated in each problem call).
176+
osys = convert(ODESystem, rn)
177+
ssys = convert(SDESystem, rn)
178+
nsys = convert(NonlinearSystem, rn)
179+
175180
# Declares valid initial conditions and parameter values
176181
u0_valid = [X1 => 1, X2 => 2]
177182
ps_valid = [k1 => 0.5, k2 => 0.1]
@@ -218,25 +223,25 @@ let
218223
]
219224

220225
# Loops through all potential parameter sets, checking their inputs yield errors.
226+
# Broken tests are due to this issue: https://github.com/SciML/ModelingToolkit.jl/issues/2779
221227
for ps in [ps_valid; ps_invalid], u0 in [u0_valid; u0s_invalid]
222228
# Handles problems with/without tspan separately. Special check ensuring that valid inputs passes.
223-
for XProblem in [ODEProblem, SDEProblem, DiscreteProblem]
229+
for (xsys, XProblem) in zip([osys, ssys, rn], [ODEProblem, SDEProblem, DiscreteProblem])
224230
if (ps == ps_valid) && (u0 == u0_valid)
225-
XProblem(rn, u0, (0.0, 1.0), ps); @test true;
231+
XProblem(xsys, u0, (0.0, 1.0), ps); @test true;
226232
else
227-
# Several of these cases do not throw errors (https://github.com/SciML/ModelingToolkit.jl/issues/2624).
228233
@test_broken false
229234
continue
230-
@test_throws Exception XProblem(rn, u0, (0.0, 1.0), ps)
235+
@test_throws Exception XProblem(xsys, u0, (0.0, 1.0), ps)
231236
end
232237
end
233-
for XProblem in [NonlinearProblem, SteadyStateProblem]
238+
for (xsys, XProblem) in zip([nsys, osys], [NonlinearProblem, SteadyStateProblem])
234239
if (ps == ps_valid) && (u0 == u0_valid)
235-
XProblem(rn, u0, ps); @test true;
240+
XProblem(xsys, u0, ps); @test true;
236241
else
237242
@test_broken false
238243
continue
239-
@test_throws Exception XProblem(rn, u0, ps)
244+
@test_throws Exception XProblem(xsys, u0, ps)
240245
end
241246
end
242247
end

Diff for: test/upstream/mtk_structure_indexing.jl

+15-19
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ begin
5050
sint = init(sprob, ImplicitEM(); save_everystep=false)
5151
jint = init(jprob, SSAStepper())
5252
nint = init(nprob, NewtonRaphson(); save_everystep=false)
53-
@test_broken ssint = init(ssprob, DynamicSS(Tsit5()); save_everystep=false) # https://github.com/SciML/SciMLBase.jl/issues/660
53+
@test_broken ssint = init(ssprob, DynamicSS(Tsit5()); save_everystep=false) # https://github.com/SciML/SteadyStateDiffEq.jl/issues/79
5454
integrators = [oint, sint, jint, nint]
5555

5656
# Creates solutions.
@@ -64,14 +64,12 @@ end
6464

6565
# Tests problem indexing and updating.
6666
let
67-
@test_broken false # A few cases fails for SteadyStateProblem: https://github.com/SciML/SciMLBase.jl/issues/660
68-
@test_broken false # Most cases broken for Ensemble problems: https://github.com/SciML/SciMLBase.jl/issues/661
69-
for prob in deepcopy(problems[1:end-1])
67+
for prob in [deepcopy(problems); deepcopy(eproblems)]
7068
# Get u values (including observables).
7169
@test prob[X] == prob[model.X] == prob[:X] == 4
7270
@test prob[XY] == prob[model.XY] == prob[:XY] == 9
7371
@test prob[[XY,Y]] == prob[[model.XY,model.Y]] == prob[[:XY,:Y]] == [9, 5]
74-
@test_broken prob[(XY,Y)] == prob[(model.XY,model.Y)] == prob[(:XY,:Y)] == (9, 5)
72+
@test_broken prob[(XY,Y)] == prob[(model.XY,model.Y)] == prob[(:XY,:Y)] == (9, 5) # https://github.com/SciML/SciMLBase.jl/issues/709
7573
@test getu(prob, X)(prob) == getu(prob, model.X)(prob) == getu(prob, :X)(prob) == 4
7674
@test getu(prob, XY)(prob) == getu(prob, model.XY)(prob) == getu(prob, :XY)(prob) == 9
7775
@test getu(prob, [XY,Y])(prob) == getu(prob, [model.XY,model.Y])(prob) == getu(prob, [:XY,:Y])(prob) == [9, 5]
@@ -117,8 +115,7 @@ end
117115

118116
# Test remake function.
119117
let
120-
@test_broken false # Currently cannot be run for Ensemble problems: https://github.com/SciML/SciMLBase.jl/issues/661 (as indexing cannot be used to check values).
121-
for prob in deepcopy(problems)
118+
for prob in [deepcopy(problems); deepcopy(eproblems)]
122119
# Remake for all u0s.
123120
rp = remake(prob; u0 = [X => 1, Y => 2])
124121
@test rp[[X, Y]] == [1, 2]
@@ -156,9 +153,7 @@ end
156153
# Test integrator indexing.
157154
let
158155
@test_broken false # NOTE: Multiple problems for `nint` (https://github.com/SciML/SciMLBase.jl/issues/662).
159-
@test_broken false # NOTE: Multiple problems for `jint` (https://github.com/SciML/SciMLBase.jl/issues/654).
160-
@test_broken false # NOTE: Cannot even create a `ssint` (https://github.com/SciML/SciMLBase.jl/issues/660).
161-
for int in deepcopy([oint, sint])
156+
for int in deepcopy([oint, sint, jint])
162157
# Get u values.
163158
@test int[X] == int[model.X] == int[:X] == 4
164159
@test int[XY] == int[model.XY] == int[:XY] == 9
@@ -208,6 +203,7 @@ let
208203
end
209204

210205
# Test solve's save_idxs argument.
206+
# Currently, `save_idxs` is broken with symbolic stuff (https://github.com/SciML/ModelingToolkit.jl/issues/1761).
211207
let
212208
for (prob, solver) in zip(deepcopy([oprob, sprob, jprob]), [Tsit5(), ImplicitEM(), SSAStepper()])
213209
# Save single variable
@@ -241,10 +237,10 @@ let
241237
@test getu(sol, (XY,Y))(sol)[1] == getu(sol, (model.XY,model.Y))(sol)[1] == getu(sol, (:XY,:Y))(sol)[1] == (9, 5)
242238

243239
# Get u values via idxs and functional call.
244-
@test osol(0.0; idxs=X) == osol(0.0; idxs=X) == osol(0.0; idxs=X) == 4
245-
@test osol(0.0; idxs=XY) == osol(0.0; idxs=XY) == osol(0.0; idxs=XY) == 9
246-
@test_broken osol(0.0; idxs=[model.Y,model.XY]) == osol(0.0; idxs=[model.Y,model.XY]) == osol(0.0; idxs=[model.XY,model.X]) == [9, 5]
247-
@test_broken osol(0.0; idxs=(:Y,:XY)) == osol(0.0; idxs=(:Y,:XY)) == osol(0.0; idxs=(:XY,:Y)) == (9, 5)
240+
@test osol(0.0; idxs=X) == osol(0.0; idxs=model.X) == osol(0.0; idxs=:X) == 4
241+
@test osol(0.0; idxs=XY) == osol(0.0; idxs=model.XY) == osol(0.0; idxs=:XY) == 9
242+
@test osol(0.0; idxs = [XY,Y]) == osol(0.0; idxs = [model.XY,model.Y]) == osol(0.0; idxs = [:XY,:Y]) == [9, 5]
243+
@test_broken osol(0.0; idxs = (XY,Y)) == osol(0.0; idxs = (model.XY,model.Y)) == osol(0.0; idxs = (:XY,:Y)) == (9, 5) # https://github.com/SciML/SciMLBase.jl/issues/711
248244

249245
# Get p values.
250246
@test sol.ps[kp] == sol.ps[model.kp] == sol.ps[:kp] == 1.0
@@ -262,11 +258,11 @@ let
262258
@test sol[X] == sol[model.X] == sol[:X]
263259
@test sol[XY] == sol[model.XY][1] == sol[:XY]
264260
@test sol[[XY,Y]] == sol[[model.XY,model.Y]] == sol[[:XY,:Y]]
265-
@test_broken sol[(XY,Y)] == sol[(model.XY,model.Y)] == sol[(:XY,:Y)]
261+
@test_broken sol[(XY,Y)] == sol[(model.XY,model.Y)] == sol[(:XY,:Y)] # https://github.com/SciML/SciMLBase.jl/issues/710
266262
@test getu(sol, X)(sol) == getu(sol, model.X)(sol)[1] == getu(sol, :X)(sol)
267263
@test getu(sol, XY)(sol) == getu(sol, model.XY)(sol)[1] == getu(sol, :XY)(sol)
268264
@test getu(sol, [XY,Y])(sol) == getu(sol, [model.XY,model.Y])(sol) == getu(sol, [:XY,:Y])(sol)
269-
@test_broken getu(sol, (XY,Y))(sol) == getu(sol, (model.XY,model.Y))(sol) == getu(sol, (:XY,:Y))(sol)[1]
265+
@test_broken getu(sol, (XY,Y))(sol) == getu(sol, (model.XY,model.Y))(sol) == getu(sol, (:XY,:Y))(sol)[1] # https://github.com/SciML/SciMLBase.jl/issues/710
270266

271267
# Get p values.
272268
@test sol.ps[kp] == sol.ps[model.kp] == sol.ps[:kp]
@@ -281,8 +277,7 @@ end
281277

282278
# Tests plotting.
283279
let
284-
@test_broken false # Currently broken for `ssol` (https://github.com/SciML/SciMLBase.jl/issues/580)
285-
for sol in deepcopy([osol, jsol])
280+
for sol in deepcopy([osol, ssol, jsol])
286281
# Single variable.
287282
@test length(plot(sol; idxs = X).series_list) == 1
288283
@test length(plot(sol; idxs = XY).series_list) == 1
@@ -386,4 +381,5 @@ let
386381
@test jint.cb.condition.ma_jumps.scaled_rates[1] == 16.0
387382
reset_aggregated_jumps!(jint)
388383
@test jint.cb.condition.ma_jumps.scaled_rates[1] == 6.0
389-
end
384+
end
385+

0 commit comments

Comments
 (0)