diff --git a/test/downstream/Project.toml b/test/downstream/Project.toml index 32941e5028..09389d54d7 100644 --- a/test/downstream/Project.toml +++ b/test/downstream/Project.toml @@ -9,6 +9,7 @@ OrdinaryDiffEq = "1dea7af3-3e70-54e6-95c3-0bf5283fa5ed" SciMLBase = "0bca4576-84f4-4d90-8ffe-ffa030f20462" SciMLSensitivity = "1ed8b502-d754-442c-8d5d-10ac956f44a1" Sundials = "c3572dad-4567-51f8-b174-8c6c989267f4" +SymbolicIndexingInterface = "2efcf032-c050-4f8e-a9bb-153293bab1f5" Unitful = "1986cc42-f94f-5a68-af5c-568840ba703d" Zygote = "e88e6eb3-aa80-5325-afca-941959d7151f" diff --git a/test/downstream/symbol_indexing.jl b/test/downstream/symbol_indexing.jl index 55d9ffbe6c..b4abf97751 100644 --- a/test/downstream/symbol_indexing.jl +++ b/test/downstream/symbol_indexing.jl @@ -37,21 +37,24 @@ p = [lorenz1.σ => 10.0, tspan = (0.0, 100.0) prob = ODEProblem(sys_simplified, u0, tspan, p) +integ = init(prob, Rodas4()) sol = solve(prob, Rodas4()) -@test_throws Any sol[b] -@test_throws Any sol[b, 1] -@test_throws Any sol[b, 1:5] -@test_throws Any sol[b, [1, 2, 3]] -@test_throws Any sol['a'] -@test_throws Any sol['a', 1] -@test_throws Any sol['a', 1:5] -@test_throws Any sol['a', [1, 2, 3]] +@testset "indexing should error" begin + for obj in [prob, integ, sol] + for sym in ['a', :b] + @test_throws Any obj[sym] + @test_throws Any obj[sym, 1] + @test_throws Any obj[sym, 1:5] + @test_throws Any obj[sym, [1, 2, 3]] + end + end +end @test sol[a] isa AbstractVector @test sol[:a] == sol[a] @test sol[a, 1] isa Real -@test sol[:a, 1] == sol[a, 1] +@test sol[:a, 1] == sol[a, 1] == prob[a] == prob[:a] == integ[a] == integ[:a] == -1.0 @test sol[a, 1:5] isa AbstractVector @test sol[:a, 1:5] == sol[a, 1:5] @test sol[a, [1, 2, 3]] isa AbstractVector