Skip to content

Commit

Permalink
Set minimum supported julia version to 1.6 (LTS) (#186)
Browse files Browse the repository at this point in the history
* ci: Update LTS version

* ci: Remove 1.5 workflow

* Adjust display tests

* Adjust plotting tests tolerance

* Set minimum supported julia version to 1.6
  • Loading branch information
pabloferz authored Jan 25, 2022
1 parent 2fe33fd commit e04f9d4
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 179 deletions.
7 changes: 1 addition & 6 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
fail-fast: false
matrix:
version:
- "1.0" # LTS
- "1.6" # LTS
- "1" # Latest Release
os:
- ubuntu-latest
Expand All @@ -30,11 +30,6 @@ jobs:
arch: x86
- os: windows-latest
arch: x86
include:
# Add a 1.5 job because that's what Invenia actually uses
- os: ubuntu-latest
version: 1.5
arch: x64
steps:
- uses: actions/checkout@v2
- uses: julia-actions/setup-julia@v1
Expand Down
6 changes: 3 additions & 3 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ Serialization = "9e88b42a-f829-5b0c-bbe9-9e923198166b"
TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"

[compat]
Documenter = "0.23, 0.24"
Documenter = "0.23, 0.24, 0.25, 0.26, 0.27"
Infinity = "0.2.3"
RecipesBase = "0.7, 0.8, 1"
TimeZones = "0.7, 0.8, 0.9, 0.10, 0.11, 1"
julia = "1"
TimeZones = "1.7"
julia = "1.6"

[extras]
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
Expand Down
6 changes: 0 additions & 6 deletions src/Intervals.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ using Dates: AbstractDateTime, value, coarserperiod

import Base: , , , , union, union!, merge

# Extend `Base.isdisjoint` when it exists
# https://github.com/JuliaLang/julia/pull/34427
if VERSION >= v"1.5.0-DEV.124"
import Base: isdisjoint
end

abstract type Bound end
abstract type Bounded <: Bound end
struct Closed <: Bounded end
Expand Down
8 changes: 0 additions & 8 deletions src/compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,3 @@ function Serialization.deserialize(s::AbstractSerializer, ::Type{AnchoredInterva

return AnchoredInterval{P,T,L,R}(anchor)
end

# Works around an issue where a `StepRangeLen` tries to convert the step to an
# `AbstractInterval`.
# Issue introduced in https://github.com/JuliaLang/julia/pull/23194 (a698230daf6)
# and fixed in https://github.com/JuliaLang/julia/pull/34412 (fca037a162)
if v"0.7.0-DEV.1399" <= VERSION < v"1.5.0-DEV.127"
Base.step(r::StepRangeLen{<:AbstractInterval}) = r.step
end
2 changes: 1 addition & 1 deletion src/interval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ function Base.issubset(a::AbstractInterval, b::AbstractInterval)
return LeftEndpoint(a) LeftEndpoint(b) && RightEndpoint(a) RightEndpoint(b)
end

function isdisjoint(a::AbstractInterval, b::AbstractInterval)
function Base.isdisjoint(a::AbstractInterval, b::AbstractInterval)
return RightEndpoint(a) < LeftEndpoint(b) || LeftEndpoint(a) > RightEndpoint(b)
end

Expand Down
161 changes: 36 additions & 125 deletions test/anchoredinterval.jl
Original file line number Diff line number Diff line change
Expand Up @@ -245,38 +245,35 @@ using Intervals: Bounded, Ending, Beginning, canonicalize, isunbounded
# When dropping VERSION < v"1.2.0-DEV.223" (https://github.com/JuliaLang/julia/pull/30817)
# - `repr(Period(...))`can be converted to hardcode strings

where_lr = "where R<:$Bounded where L<:$Bounded"
where_tlr = "$where_lr where T"
where_lr = "where {L<:$Bounded, R<:$Bounded}"
where_tlr = "where {T, L<:$Bounded, R<:$Bounded}"

where_lr2 = "where {L<:$Bounded, R<:$Bounded}"
where_tlr2 = "where {T, L<:$Bounded, R<:$Bounded}"

if VERSION >= v"1.6.0"
if VERSION >= v"1.7.0"
@test sprint(show, AnchoredInterval{Hour(-1)}) ==
"HourEnding{T, L, R} $where_tlr2"
"HourEnding"
@test sprint(show, AnchoredInterval{Hour(1)}) ==
"HourBeginning{T, L, R} $where_tlr2"
"HourBeginning"
@test sprint(show, AnchoredInterval{Day(-1)}) ==
"AnchoredInterval{$(repr(Day(-1))), T, L, R} $where_tlr2"
"AnchoredInterval{$(repr(Day(-1)))}"
@test sprint(show, AnchoredInterval{Day(1)}) ==
"AnchoredInterval{$(repr(Day(1))), T, L, R} $where_tlr2"
"AnchoredInterval{$(repr(Day(1)))}"
@test sprint(show, AnchoredInterval{Day(-1), DateTime}) ==
"AnchoredInterval{$(repr(Day(-1))), DateTime, L, R} $where_lr2"
"AnchoredInterval{$(repr(Day(-1))), DateTime}"
@test sprint(show, AnchoredInterval{Day(1), DateTime}) ==
"AnchoredInterval{$(repr(Day(1))), DateTime, L, R} $where_lr2"
"AnchoredInterval{$(repr(Day(1))), DateTime}"
else
@test sprint(show, AnchoredInterval{Hour(-1)}) ==
"AnchoredInterval{$(repr(Hour(-1))),T,L,R} $where_tlr"
"HourEnding{T, L, R} $where_tlr"
@test sprint(show, AnchoredInterval{Hour(1)}) ==
"AnchoredInterval{$(repr(Hour(1))),T,L,R} $where_tlr"
"HourBeginning{T, L, R} $where_tlr"
@test sprint(show, AnchoredInterval{Day(-1)}) ==
"AnchoredInterval{$(repr(Day(-1))),T,L,R} $where_tlr"
"AnchoredInterval{$(repr(Day(-1))), T, L, R} $where_tlr"
@test sprint(show, AnchoredInterval{Day(1)}) ==
"AnchoredInterval{$(repr(Day(1))),T,L,R} $where_tlr"
"AnchoredInterval{$(repr(Day(1))), T, L, R} $where_tlr"
@test sprint(show, AnchoredInterval{Day(-1), DateTime}) ==
"AnchoredInterval{$(repr(Day(-1))),DateTime,L,R} $where_lr"
"AnchoredInterval{$(repr(Day(-1))), DateTime, L, R} $where_lr"
@test sprint(show, AnchoredInterval{Day(1), DateTime}) ==
"AnchoredInterval{$(repr(Day(1))),DateTime,L,R} $where_lr"
"AnchoredInterval{$(repr(Day(1))), DateTime, L, R} $where_lr"
end

# Tuples contain fields: interval, printed, shown
Expand All @@ -285,167 +282,111 @@ using Intervals: Bounded, Ending, Beginning, canonicalize, isunbounded
HourEnding(dt),
"(2016-08-11 HE02]",
string(
if VERSION >= v"1.6.0-DEV.347"
"HourEnding{DateTime, Open, Closed}"
else
"AnchoredInterval{$(repr(Hour(-1))),DateTime,Open,Closed}"
end,
"HourEnding{DateTime, Open, Closed}",
"($(repr(DateTime(2016, 8, 11, 2))))",
),
),
(
HourEnding{Closed, Open}(DateTime(2013, 2, 13)),
"[2013-02-12 HE24)",
string(
if VERSION >= v"1.6.0-DEV.347"
"HourEnding{DateTime, Closed, Open}"
else
"AnchoredInterval{$(repr(Hour(-1))),DateTime,Closed,Open}"
end,
"HourEnding{DateTime, Closed, Open}",
"($(repr(DateTime(2013, 2, 13))))",
),
),
(
HourEnding(dt + Minute(15) + Second(30)),
"(2016-08-11 HE02:15:30]",
string(
if VERSION >= v"1.6.0"
"HourEnding{DateTime, Open, Closed}"
else
"AnchoredInterval{$(repr(Hour(-1))),DateTime,Open,Closed}"
end,
"HourEnding{DateTime, Open, Closed}",
"($(repr(DateTime(2016, 8, 11, 2, 15, 30))))",
),
),
(
HourEnding(dt + Millisecond(2)),
"(2016-08-11 HE02:00:00.002]",
string(
if VERSION >= v"1.6.0"
"HourEnding{DateTime, Open, Closed}"
else
"AnchoredInterval{$(repr(Hour(-1))),DateTime,Open,Closed}"
end,
"HourEnding{DateTime, Open, Closed}",
"($(repr(DateTime(2016, 8, 11, 2, 0, 0, 2))))",
),
),
(
HourEnding{Closed, Open}(DateTime(2013, 2, 13, 0, 1)),
"[2013-02-13 HE00:01:00)",
string(
if VERSION >= v"1.6.0"
"HourEnding{DateTime, Closed, Open}"
else
"AnchoredInterval{$(repr(Hour(-1))),DateTime,Closed,Open}"
end,
"HourEnding{DateTime, Closed, Open}",
"($(repr(DateTime(2013, 2, 13, 0, 1))))",
),
),
(
HourBeginning(dt),
"[2016-08-11 HB02)",
string(
if VERSION >= v"1.6.0"
"HourBeginning{DateTime, Closed, Open}"
else
"AnchoredInterval{$(repr(Hour(1))),DateTime,Closed,Open}"
end,
"HourBeginning{DateTime, Closed, Open}",
"($(repr(DateTime(2016, 8, 11, 2))))",
),
),
(
HourBeginning{Open, Closed}(DateTime(2013, 2, 13)),
"(2013-02-13 HB00]",
string(
if VERSION >= v"1.6.0"
"HourBeginning{DateTime, Open, Closed}"
else
"AnchoredInterval{$(repr(Hour(1))),DateTime,Open,Closed}"
end,
"HourBeginning{DateTime, Open, Closed}",
"($(repr(DateTime(2013, 2, 13))))",
),
),
(
HourEnding(ZonedDateTime(dt, tz"America/Winnipeg")),
"(2016-08-11 HE02-05:00]",
string(
if VERSION >= v"1.6.0"
"HourEnding{$ZonedDateTime, Open, Closed}"
else
"AnchoredInterval{$(repr(Hour(-1))),$ZonedDateTime,Open,Closed}"
end,
"HourEnding{$ZonedDateTime, Open, Closed}",
"($(repr(ZonedDateTime(dt, tz"America/Winnipeg"))))",
),
),
(
AnchoredInterval{Year(-1)}(Date(dt)),
"(YE 2016-08-11]",
string(
if VERSION >= v"1.6.0"
"AnchoredInterval{$(repr(Year(-1))), Date, Open, Closed}"
else
"AnchoredInterval{$(repr(Year(-1))),Date,Open,Closed}"
end,
"AnchoredInterval{$(repr(Year(-1))), Date, Open, Closed}",
"($(repr(Date(2016, 8, 11))))",
),
),
(
AnchoredInterval{Year(-1)}(ceil(Date(dt), Year)),
"(YE 2017-01-01]",
string(
if VERSION >= v"1.6.0"
"AnchoredInterval{$(repr(Year(-1))), Date, Open, Closed}"
else
"AnchoredInterval{$(repr(Year(-1))),Date,Open,Closed}"
end,
"AnchoredInterval{$(repr(Year(-1))), Date, Open, Closed}",
"($(repr(Date(2017, 1, 1))))",
),
),
(
AnchoredInterval{Month(-1)}(dt),
"(MoE 2016-08-11 02:00:00]",
string(
if VERSION >= v"1.6.0"
"AnchoredInterval{$(repr(Month(-1))), DateTime, Open, Closed}"
else
"AnchoredInterval{$(repr(Month(-1))),DateTime,Open,Closed}"
end,
"AnchoredInterval{$(repr(Month(-1))), DateTime, Open, Closed}",
"($(repr(DateTime(2016, 8, 11, 2, 0, 0))))",
),
),
(
AnchoredInterval{Month(-1)}(ceil(dt, Month)),
"(MoE 2016-09-01]",
string(
if VERSION >= v"1.6.0"
"AnchoredInterval{$(repr(Month(-1))), DateTime, Open, Closed}"
else
"AnchoredInterval{$(repr(Month(-1))),DateTime,Open,Closed}"
end,
"AnchoredInterval{$(repr(Month(-1))), DateTime, Open, Closed}",
"($(repr(DateTime(2016, 9, 1))))",
),
),
(
AnchoredInterval{Day(-1)}(DateTime(dt)),
"(DE 2016-08-11 02:00:00]",
string(
if VERSION >= v"1.6.0"
"AnchoredInterval{$(repr(Day(-1))), DateTime, Open, Closed}"
else
"AnchoredInterval{$(repr(Day(-1))),DateTime,Open,Closed}"
end,
"AnchoredInterval{$(repr(Day(-1))), DateTime, Open, Closed}",
"($(repr(DateTime(2016, 8, 11, 2))))",
),
),
(
AnchoredInterval{Day(-1)}(ceil(DateTime(dt), Day)),
"(DE 2016-08-12]",
string(
if VERSION >= v"1.6.0"
"AnchoredInterval{$(repr(Day(-1))), DateTime, Open, Closed}"
else
"AnchoredInterval{$(repr(Day(-1))),DateTime,Open,Closed}"
end,
"AnchoredInterval{$(repr(Day(-1))), DateTime, Open, Closed}",
"($(repr(DateTime(2016, 8, 12))))",
),
),
Expand All @@ -454,11 +395,7 @@ using Intervals: Bounded, Ending, Beginning, canonicalize, isunbounded
AnchoredInterval{Day(-1)}(Date(dt)),
"(DE 2016-08-11]",
string(
if VERSION >= v"1.6.0"
"AnchoredInterval{$(repr(Day(-1))), Date, Open, Closed}"
else
"AnchoredInterval{$(repr(Day(-1))),Date,Open,Closed}"
end,
"AnchoredInterval{$(repr(Day(-1))), Date, Open, Closed}",
"($(repr(Date(2016, 8, 11))))",
),
),
Expand All @@ -470,47 +407,31 @@ using Intervals: Bounded, Ending, Beginning, canonicalize, isunbounded
),
"(DE 2016-08-12 00:00:00-05:00]",
string(
if VERSION >= v"1.6.0"
"AnchoredInterval{$(repr(Day(-1))), $ZonedDateTime, Open, Closed}"
else
"AnchoredInterval{$(repr(Day(-1))),$ZonedDateTime,Open,Closed}"
end,
"AnchoredInterval{$(repr(Day(-1))), $ZonedDateTime, Open, Closed}",
"($(repr(ZonedDateTime(2016, 8, 12, tz"America/Winnipeg"))))",
),
),
(
AnchoredInterval{Minute(-5)}(dt),
"(2016-08-11 5ME02:00]",
string(
if VERSION >= v"1.6.0"
"AnchoredInterval{$(repr(Minute(-5))), DateTime, Open, Closed}"
else
"AnchoredInterval{$(repr(Minute(-5))),DateTime,Open,Closed}"
end,
"AnchoredInterval{$(repr(Minute(-5))), DateTime, Open, Closed}",
"($(repr(DateTime(2016, 8, 11, 2))))",
),
),
(
AnchoredInterval{Second(-30)}(dt),
"(2016-08-11 30SE02:00:00]",
string(
if VERSION >= v"1.6.0"
"AnchoredInterval{$(repr(Second(-30))), DateTime, Open, Closed}"
else
"AnchoredInterval{$(repr(Second(-30))),DateTime,Open,Closed}"
end,
"AnchoredInterval{$(repr(Second(-30))), DateTime, Open, Closed}",
"($(repr(DateTime(2016, 8, 11, 2))))",
),
),
(
AnchoredInterval{Millisecond(-10)}(dt),
"(2016-08-11 10msE02:00:00.000]",
string(
if VERSION >= v"1.6.0"
"AnchoredInterval{$(repr(Millisecond(-10))), DateTime, Open, Closed}"
else
"AnchoredInterval{$(repr(Millisecond(-10))),DateTime,Open,Closed}"
end,
"AnchoredInterval{$(repr(Millisecond(-10))), DateTime, Open, Closed}",
"($(repr(DateTime(2016, 8, 11, 2))))",
),
),
Expand All @@ -532,23 +453,13 @@ using Intervals: Bounded, Ending, Beginning, canonicalize, isunbounded
@test string(interval) == "(0 .. 10]"
@test sprint(show, interval, context=:compact=>true) == string(interval)

shown = if VERSION >= v"1.6.0"
"AnchoredInterval{-10, $Int, Open, Closed}(10)"
else
"AnchoredInterval{-10,$Int,Open,Closed}(10)"
end
@test sprint(show, interval) == shown
@test sprint(show, interval) == "AnchoredInterval{-10, $Int, Open, Closed}(10)"

interval = AnchoredInterval{25}('a')
@test string(interval) == "[a .. z)"
@test sprint(show, interval, context=:compact=>true) == string(interval)

shown = if VERSION >= v"1.6.0"
"AnchoredInterval{25, Char, Closed, Open}('a')"
else
"AnchoredInterval{25,Char,Closed,Open}('a')"
end
@test sprint(show, interval) == shown
@test sprint(show, interval) == "AnchoredInterval{25, Char, Closed, Open}('a')"
end

@testset "equality" begin
Expand Down
Loading

0 comments on commit e04f9d4

Please sign in to comment.