From f3d524ff69d493cfe42d0f852ae289961aef0914 Mon Sep 17 00:00:00 2001 From: Joe Greener Date: Tue, 1 Aug 2023 14:02:40 +0100 Subject: [PATCH] Enable try/catch test --- test/runtests.jl | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/test/runtests.jl b/test/runtests.jl index 4fb5dc3aac..556d8f90b0 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -411,19 +411,16 @@ end @test autodiff(Reverse, f24, Active, Active(2.0))[1][1] == 3 @test autodiff(Forward, f24, Duplicated(2.0, 1.0))[1] == 3 - # See #971 - @static if VERSION ≥ v"1.9-" - function f25(x) - try - sqrt(-1.0) - return 3x - catch - return 2x - end + function f25(x) + try + sqrt(-1.0) + return 3x + catch + return 2x end - @test autodiff(Reverse, f25, Active, Active(2.0))[1][1] == 2 - @test autodiff(Forward, f25, Duplicated(2.0, 1.0))[1] == 2 end + @test autodiff(Reverse, f25, Active, Active(2.0))[1][1] == 2 + @test autodiff(Forward, f25, Duplicated(2.0, 1.0))[1] == 2 f26(x) = circshift([1.0, 2x, 3.0], 1)[end] @test autodiff(Reverse, f26, Active, Active(2.0))[1][1] == 2 @@ -2624,7 +2621,7 @@ end @test autodiff(Reverse, f8, Active, Active(1.5))[1][1] == 0 @test autodiff(Forward, f8, Duplicated(1.5, 1.0))[1] == 0 - # On Julia 1.6 the gradients are wrong (0.7 not 1.2) + # On Julia 1.6 the gradients are wrong (0.7 not 1.2), see #973 @static if VERSION ≥ v"1.7-" f9(x) = sum(quantile([1.0, x], [0.5, 0.7])) @test autodiff(Reverse, f9, Active, Active(2.0))[1][1] == 1.2