Skip to content

Commit 2fdbe81

Browse files
committed
pass context to printing tests
1 parent 9f5b498 commit 2fdbe81

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

test/stopping_criterion.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ problem = AIT.DummyProblem()
88
@testset "StopAfterIteration" begin
99
s1 = StopAfterIteration(2)
1010
@test s1 isa StoppingCriterion
11-
@test repr(s1) == "StopAfterIteration(2)"
11+
@test repr(s1; context = :module => @__MODULE__) == "StopAfterIteration(2)"
1212
@test !indicates_convergence(s1)
1313
algorithm = AIT.DummyAlgorithm(s1)
1414
s1_state = initialize_state(problem, algorithm, s1)
@@ -26,7 +26,7 @@ end
2626
@testset "StopAfter" begin
2727
s1 = StopAfter(Nanosecond(7))
2828
@test s1 isa StoppingCriterion
29-
@test string(s1) == "StopAfter(Nanosecond(7))"
29+
@test sprint(show, s1; context = :module => @__MODULE__) == "StopAfter(Nanosecond(7))"
3030
@test_throws ArgumentError StopAfter(Second(-1))
3131

3232
algorithm = AIT.DummyAlgorithm(s1)
@@ -53,7 +53,7 @@ end
5353
s1b = StopWhenAll([c1, c2])
5454
@test s1 == s1b
5555
@test s1 isa StoppingCriterion
56-
@test sprint((io, x) -> show(io, MIME"text/plain"(), x), s1) ==
56+
@test sprint((io, x) -> show(io, MIME"text/plain"(), x), s1; context = :module => @__MODULE__) ==
5757
"StopWhenAll with the Stopping Criteria:\n StopAfterIteration(2)\n StopAfter(Nanosecond(2))"
5858
algorithm = AIT.DummyAlgorithm(s1)
5959
s1_state = initialize_state(problem, algorithm, s1)
@@ -97,7 +97,7 @@ end
9797
s1 = c1 | c2
9898
@test s1 isa StoppingCriterion
9999
@test s1 == StopWhenAny([c1, c2])
100-
@test sprint((io, x) -> show(io, MIME"text/plain"(), x), s1) ==
100+
@test sprint((io, x) -> show(io, MIME"text/plain"(), x), s1; context = :module => @__MODULE__) ==
101101
"StopWhenAny with the Stopping Criteria:\n StopAfterIteration(2)\n StopAfter(Second(1))"
102102
@test !indicates_convergence(s1)
103103

0 commit comments

Comments
 (0)