Skip to content

Commit 390341f

Browse files
committed
Fix tests
1 parent 6f68b2a commit 390341f

File tree

3 files changed

+4
-7
lines changed

3 files changed

+4
-7
lines changed

src/default.jl

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,12 @@ end
142142

143143
resids = map(x -> Symbol("$(x)_resid"), cache_syms)
144144
for (sym, resid) in zip(cache_syms, resids)
145-
push!(calls, :($(resid) = get_fu($(sym))))
145+
push!(calls, :($(resid) = @isdefined($(sym)) ? get_fu($(sym)) : nothing))
146146
end
147147
push!(calls,
148148
quote
149149
fus = tuple($(Tuple(resids)...))
150150
minfu, idx = __findmin(cache.internalnorm, fus)
151-
idx += cache.alg.start_index - 1
152151
stats = __compile_stats(cache.caches[idx])
153152
u = get_u(cache.caches[idx])
154153
retcode = cache.caches[idx].retcode
@@ -225,13 +224,12 @@ for (probType, pType) in ((:NonlinearProblem, :NLS), (:NonlinearLeastSquaresProb
225224

226225
resids = map(x -> Symbol("$(x)_resid"), sol_syms)
227226
for (sym, resid) in zip(sol_syms, resids)
228-
push!(calls, :($(resid) = $(sym).resid))
227+
push!(calls, :($(resid) = @isdefined($(sym)) ? $(sym).resid : nothing))
229228
end
230229

231230
push!(calls, quote
232231
resids = tuple($(Tuple(resids)...))
233232
minfu, idx = __findmin(DEFAULT_NORM, resids)
234-
idx += alg.start_index - 1
235233
end)
236234

237235
for i in 1:N

src/utils.jl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,7 @@ function __findmin_caches(f, caches)
9999
end
100100
function __findmin(f, x)
101101
return findmin(x) do xᵢ
102+
xᵢ === nothing && return Inf
102103
fx = f(xᵢ)
103104
return isnan(fx) ? Inf : fx
104105
end

test/misc/polyalg_tests.jl

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,8 @@ end
8484
Broyden(; autodiff = AutoFiniteDiff()), LimitedMemoryBroyden()))
8585

8686
# Uses the `__solve` function
87-
solver = solve(probN; abstol = 1e-9)
88-
@test SciMLBase.successful_retcode(solver)
87+
@test_throws MethodError solve(probN; abstol = 1e-9)
8988
@test_throws MethodError solve(probN, RobustMultiNewton(); abstol = 1e-9)
90-
@test SciMLBase.successful_retcode(solver)
9189
solver = solve(probN, RobustMultiNewton(; autodiff = AutoFiniteDiff()); abstol = 1e-9)
9290
@test SciMLBase.successful_retcode(solver)
9391
solver = solve(

0 commit comments

Comments
 (0)