Added tests for xlims with Date and DateTime types
This commit is contained in:
parent
c857d59400
commit
c35adbfeff
@ -14,3 +14,29 @@ using Plots, Test, Dates
|
||||
@test Plots.ylims(p) == ref_ylims
|
||||
@test Plots.xlims(p) == ref_xlims
|
||||
end # testset
|
||||
|
||||
@testset "Date xlims" begin
|
||||
y=[1.0*i*i for i in 1:10]
|
||||
x=[Date(2019,11,i) for i in 1:10]
|
||||
span = (Date(2019,10,31), Date(2019,11,11))
|
||||
|
||||
p = plot(x,y, xlims=span, widen = false)
|
||||
|
||||
ref_ylims = (y[1], y[end])
|
||||
ref_xlims = span
|
||||
@test Plots.ylims(p) == ref_ylims
|
||||
@test Plots.xlims(p) == ref_xlims
|
||||
end # testset
|
||||
|
||||
@testset "DateTime xlims" begin
|
||||
y=[1.0*i*i for i in 1:10]
|
||||
x=[Date(2019,11,i) for i in 1:10]
|
||||
span = (DateTime(2019,10,31,11,59,59), DateTime(2019,11,11,12,01,15))
|
||||
|
||||
p = plot(x,y, xlims=span, widen = false)
|
||||
|
||||
ref_ylims = (y[1], y[end])
|
||||
ref_xlims = span
|
||||
@test Plots.ylims(p) == ref_ylims
|
||||
@test Plots.xlims(p) == ref_xlims
|
||||
end # testset
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user