|
13 | 13 | v_standard = NonlinearVerbosity(SciMLLogging.Standard()) |
14 | 14 | v_detailed = NonlinearVerbosity(SciMLLogging.Detailed()) |
15 | 15 |
|
16 | | - @test v_none.non_enclosing_interval isa SciMLLogging.Silent |
17 | | - @test v_none.threshold_state isa SciMLLogging.Silent |
18 | | - @test v_none.alias_u0_immutable isa SciMLLogging.Silent |
19 | | - @test v_none.sensitivity_vjp_choice isa SciMLLogging.Silent |
20 | | - |
21 | | - @test v_minimal.non_enclosing_interval isa SciMLLogging.WarnLevel |
22 | | - @test v_minimal.alias_u0_immutable isa SciMLLogging.Silent |
23 | | - @test v_minimal.termination_condition isa SciMLLogging.Silent |
24 | | - @test v_minimal.sensitivity_vjp_choice isa SciMLLogging.Silent |
25 | | - |
26 | | - @test v_standard.non_enclosing_interval isa SciMLLogging.WarnLevel |
27 | | - @test v_standard.threshold_state isa SciMLLogging.WarnLevel |
28 | | - @test v_standard.sensitivity_vjp_choice isa SciMLLogging.WarnLevel |
29 | | - |
30 | | - @test v_detailed.alias_u0_immutable isa SciMLLogging.WarnLevel |
31 | | - @test v_detailed.termination_condition isa SciMLLogging.WarnLevel |
32 | | - @test v_detailed.sensitivity_vjp_choice isa SciMLLogging.WarnLevel |
33 | | - |
34 | | - @test v_all.linsolve_failed_noncurrent isa SciMLLogging.WarnLevel |
35 | | - @test v_all.threshold_state isa SciMLLogging.InfoLevel |
36 | | - @test v_all.sensitivity_vjp_choice isa SciMLLogging.WarnLevel |
| 16 | + @test v_none.non_enclosing_interval == SciMLLogging.Silent() |
| 17 | + @test v_none.threshold_state == SciMLLogging.Silent() |
| 18 | + @test v_none.alias_u0_immutable == SciMLLogging.Silent() |
| 19 | + @test v_none.sensitivity_vjp_choice == SciMLLogging.Silent() |
| 20 | + |
| 21 | + @test v_minimal.non_enclosing_interval == SciMLLogging.WarnLevel() |
| 22 | + @test v_minimal.alias_u0_immutable == SciMLLogging.Silent() |
| 23 | + @test v_minimal.termination_condition == SciMLLogging.Silent() |
| 24 | + @test v_minimal.sensitivity_vjp_choice == SciMLLogging.Silent() |
| 25 | + |
| 26 | + @test v_standard.non_enclosing_interval == SciMLLogging.WarnLevel() |
| 27 | + @test v_standard.threshold_state == SciMLLogging.WarnLevel() |
| 28 | + @test v_standard.sensitivity_vjp_choice == SciMLLogging.WarnLevel() |
| 29 | + |
| 30 | + @test v_detailed.alias_u0_immutable == SciMLLogging.WarnLevel() |
| 31 | + @test v_detailed.termination_condition == SciMLLogging.WarnLevel() |
| 32 | + @test v_detailed.sensitivity_vjp_choice == SciMLLogging.WarnLevel() |
| 33 | + |
| 34 | + @test v_all.linsolve_failed_noncurrent == SciMLLogging.WarnLevel() |
| 35 | + @test v_all.threshold_state == SciMLLogging.InfoLevel() |
| 36 | + @test v_all.sensitivity_vjp_choice == SciMLLogging.WarnLevel() |
37 | 37 | end |
38 | 38 |
|
39 | 39 | @testset "Group-level keyword constructors" begin |
40 | 40 | v_error = NonlinearVerbosity(error_control = SciMLLogging.ErrorLevel()) |
41 | | - @test v_error.alias_u0_immutable isa SciMLLogging.ErrorLevel |
42 | | - @test v_error.non_enclosing_interval isa SciMLLogging.ErrorLevel |
43 | | - @test v_error.termination_condition isa SciMLLogging.ErrorLevel |
44 | | - @test v_error.linsolve_failed_noncurrent isa SciMLLogging.ErrorLevel |
| 41 | + @test v_error.alias_u0_immutable == SciMLLogging.ErrorLevel() |
| 42 | + @test v_error.non_enclosing_interval == SciMLLogging.ErrorLevel() |
| 43 | + @test v_error.termination_condition == SciMLLogging.ErrorLevel() |
| 44 | + @test v_error.linsolve_failed_noncurrent == SciMLLogging.ErrorLevel() |
45 | 45 |
|
46 | 46 | v_numerical = NonlinearVerbosity(numerical = SciMLLogging.Silent()) |
47 | | - @test v_numerical.threshold_state isa SciMLLogging.Silent |
| 47 | + @test v_numerical.threshold_state == SciMLLogging.Silent() |
48 | 48 |
|
49 | 49 | v_sensitivity = NonlinearVerbosity(sensitivity = SciMLLogging.Silent()) |
50 | | - @test v_sensitivity.sensitivity_vjp_choice isa SciMLLogging.Silent |
| 50 | + @test v_sensitivity.sensitivity_vjp_choice == SciMLLogging.Silent() |
51 | 51 |
|
52 | 52 | v_sensitivity2 = NonlinearVerbosity(sensitivity = SciMLLogging.InfoLevel()) |
53 | | - @test v_sensitivity2.sensitivity_vjp_choice isa SciMLLogging.InfoLevel |
| 53 | + @test v_sensitivity2.sensitivity_vjp_choice == SciMLLogging.InfoLevel() |
54 | 54 | end |
55 | 55 |
|
56 | 56 | @testset "Mixed group and individual settings" begin |
|
60 | 60 | error_control = SciMLLogging.InfoLevel() |
61 | 61 | ) |
62 | 62 | # Individual override should take precedence |
63 | | - @test v_mixed.threshold_state isa SciMLLogging.WarnLevel |
| 63 | + @test v_mixed.threshold_state == SciMLLogging.WarnLevel() |
64 | 64 | # Error control group setting should apply |
65 | | - @test v_mixed.alias_u0_immutable isa SciMLLogging.InfoLevel |
66 | | - @test v_mixed.linsolve_failed_noncurrent isa SciMLLogging.InfoLevel |
| 65 | + @test v_mixed.alias_u0_immutable == SciMLLogging.InfoLevel() |
| 66 | + @test v_mixed.linsolve_failed_noncurrent == SciMLLogging.InfoLevel() |
67 | 67 | end |
68 | 68 |
|
69 | 69 | @testset "Individual keyword arguments" begin |
|
72 | 72 | threshold_state = SciMLLogging.InfoLevel(), |
73 | 73 | termination_condition = SciMLLogging.Silent() |
74 | 74 | ) |
75 | | - @test v_individual.alias_u0_immutable isa SciMLLogging.ErrorLevel |
76 | | - @test v_individual.threshold_state isa SciMLLogging.InfoLevel |
77 | | - @test v_individual.termination_condition isa SciMLLogging.Silent |
| 75 | + @test v_individual.alias_u0_immutable == SciMLLogging.ErrorLevel() |
| 76 | + @test v_individual.threshold_state == SciMLLogging.InfoLevel() |
| 77 | + @test v_individual.termination_condition == SciMLLogging.Silent() |
78 | 78 | # Unspecified options should use defaults |
79 | | - @test v_individual.non_enclosing_interval isa SciMLLogging.WarnLevel |
80 | | - @test v_individual.linsolve_failed_noncurrent isa SciMLLogging.WarnLevel |
| 79 | + @test v_individual.non_enclosing_interval == SciMLLogging.WarnLevel() |
| 80 | + @test v_individual.linsolve_failed_noncurrent == SciMLLogging.WarnLevel() |
81 | 81 | end |
82 | 82 |
|
83 | 83 | g(u, p) = u^2 - 4 |
|
192 | 192 | # Test verbose = false converts to NonlinearVerbosity(None()) |
193 | 193 | cache2 = init(prob, verbose = false) |
194 | 194 | @test cache2.verbose isa NonlinearVerbosity |
195 | | - @test cache2.verbose.threshold_state isa SciMLLogging.Silent |
196 | | - @test cache2.verbose.non_enclosing_interval isa SciMLLogging.Silent |
| 195 | + @test cache2.verbose.threshold_state == SciMLLogging.Silent() |
| 196 | + @test cache2.verbose.non_enclosing_interval == SciMLLogging.Silent() |
197 | 197 | end |
198 | 198 |
|
199 | 199 | @testset "init with Preset verbose" begin |
|
205 | 205 | # Test verbose = SciMLLogging.None() converts to NonlinearVerbosity(None()) |
206 | 206 | cache2 = init(prob, verbose = SciMLLogging.None()) |
207 | 207 | @test cache2.verbose isa NonlinearVerbosity |
208 | | - @test cache2.verbose.threshold_state isa SciMLLogging.Silent |
| 208 | + @test cache2.verbose.threshold_state == SciMLLogging.Silent() |
209 | 209 |
|
210 | 210 | # Test verbose = SciMLLogging.Detailed() |
211 | 211 | cache3 = init(prob, verbose = SciMLLogging.Detailed()) |
212 | 212 | @test cache3.verbose isa NonlinearVerbosity |
213 | | - @test cache3.verbose.linear_verbosity isa SciMLLogging.Detailed |
| 213 | + @test cache3.verbose.linear_verbosity == SciMLLogging.Detailed() |
214 | 214 |
|
215 | 215 | # Test verbose = SciMLLogging.All() |
216 | 216 | cache4 = init(prob, verbose = SciMLLogging.All()) |
|
220 | 220 | # Test verbose = SciMLLogging.Minimal() |
221 | 221 | cache5 = init(prob, verbose = SciMLLogging.Minimal()) |
222 | 222 | @test cache5.verbose isa NonlinearVerbosity |
223 | | - @test cache5.verbose.alias_u0_immutable isa SciMLLogging.Silent |
| 223 | + @test cache5.verbose.alias_u0_immutable == SciMLLogging.Silent() |
224 | 224 | end |
225 | 225 |
|
226 | 226 | @testset "init then solve with converted verbose" begin |
|
231 | 231 |
|
232 | 232 | @testset "NonlinearVerbosity with keyword message levels (issue #796)" begin |
233 | 233 | # Regression test: constructing NonlinearVerbosity with keyword arguments |
234 | | - # that are AbstractMessageLevel subtypes should not throw UndefVarError |
| 234 | + # that are MessageLevel subtypes should not throw UndefVarError |
235 | 235 | verb = NonlinearVerbosity(non_enclosing_interval = SciMLLogging.ErrorLevel()) |
236 | | - @test verb.non_enclosing_interval isa SciMLLogging.ErrorLevel |
| 236 | + @test verb.non_enclosing_interval == SciMLLogging.ErrorLevel() |
237 | 237 |
|
238 | 238 | # Test with the full solve pipeline from the issue MWE |
239 | 239 | f_interval(x, p) = x^2 - p |
|
0 commit comments