From 03a4ecdd92815a4ef668956ee56e6795e30c6dc6 Mon Sep 17 00:00:00 2001 From: Pablo Zubieta <8410335+pabloferz@users.noreply.github.com> Date: Thu, 27 Jan 2022 17:55:43 -0600 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Curtis Vogt --- src/interval.jl | 4 ++-- test/interval.jl | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/interval.jl b/src/interval.jl index efb317e1..ebb5141f 100644 --- a/src/interval.jl +++ b/src/interval.jl @@ -237,9 +237,9 @@ end only(interval::AbstractInterval) Returns the only element of a closed interval with coinciding endpoints (throws a -DomainError otherwise). +`DomainError` otherwise). """ -function Base.only(interval::Interval) +function Base.only(interval::AbstractInterval) if first(interval) == last(interval) && isclosed(interval) return first(interval) else diff --git a/test/interval.jl b/test/interval.jl index a017b47a..7b5c877d 100644 --- a/test/interval.jl +++ b/test/interval.jl @@ -97,7 +97,7 @@ @test hash(a) == hash(b) end - @testset "conversion" begin + @testset "only" begin @test_throws DomainError only(Interval{Open, Open}(10, 10)) @test_throws DomainError only(Interval{Open, Closed}(10, 10)) @test_throws DomainError only(Interval{Closed, Open}(10, 10))