From 0d427c9880bade131acadf157618894831f3c750 Mon Sep 17 00:00:00 2001 From: Alexander Barth Date: Mon, 29 Apr 2024 22:38:58 +0200 Subject: [PATCH] test ambiguities --- Project.toml | 8 +------- src/dataset.jl | 2 +- src/types.jl | 6 +++--- src/variable.jl | 4 ++-- test/Project.toml | 2 ++ test/runtests.jl | 1 + test/test_aqua.jl | 4 ++++ 7 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 test/test_aqua.jl diff --git a/Project.toml b/Project.toml index 6058003..51419a0 100644 --- a/Project.toml +++ b/Project.toml @@ -16,10 +16,4 @@ DataStructures = "0.17, 0.18" DiskArrays = "0.3.22, 0.4" JSON = "0.21" Zarr = "0.9.2" -julia = "1" - -[extras] -Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" - -[targets] -test = ["Test"] +julia = "1.6" diff --git a/src/dataset.jl b/src/dataset.jl index c2f5ef6..c6881b5 100644 --- a/src/dataset.jl +++ b/src/dataset.jl @@ -137,7 +137,7 @@ function ZarrDataset(url::AbstractString,mode = "r"; zg = zgroup(store, "",attrs = Dict(attrib)) iswritable = true end - ZarrDataset(zg,parentdataset,dimensions,iswritable,maskingvalue) + ZarrDataset(parentdataset,zg,dimensions,iswritable,maskingvalue) end diff --git a/src/types.jl b/src/types.jl index fff77e3..21379c5 100644 --- a/src/types.jl +++ b/src/types.jl @@ -1,12 +1,12 @@ -struct ZarrVariable{T,N,TZA,TZG} <: CDM.AbstractVariable{T,N} where TZA <: AbstractArray{T,N} +struct ZarrVariable{T,N,TZA <: AbstractArray{T,N},TZG} <: CDM.AbstractVariable{T,N} zarray::TZA parentdataset::TZG end -struct ZarrDataset{TZ,TP,Tmaskingvalue} <: CDM.AbstractDataset +struct ZarrDataset{TDS <: Union{CDM.AbstractDataset,Nothing},Tmaskingvalue,TZ} <: CDM.AbstractDataset + parentdataset::TDS zgroup::TZ - parentdataset::TP dimensions::OrderedDict{Symbol,Int} iswritable::Bool maskingvalue::Tmaskingvalue diff --git a/src/variable.jl b/src/variable.jl index 81eed7d..fd61f29 100644 --- a/src/variable.jl +++ b/src/variable.jl @@ -1,8 +1,8 @@ -Base.getindex(v::ZarrVariable,ij...) = v.zarray[ij...] +Base.getindex(v::ZarrVariable,ij::Union{Integer,Colon,AbstractVector{<:Integer}}...) = v.zarray[ij...] CDM.load!(v::ZarrVariable,buffer,ij...) = buffer .= view(v.zarray,ij...) -function Base.setindex!(v::ZarrVariable,data,ij...) +function Base.setindex!(v::ZarrVariable,data,ij::Union{Integer,Colon,AbstractVector{<:Integer}}...) v.zarray[ij...] = data end Base.size(v::ZarrVariable) = size(v.zarray) diff --git a/test/Project.toml b/test/Project.toml index efdf987..76756a4 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,4 +1,5 @@ [deps] +Aqua = "4c88cf16-eb10-579e-8560-4a9242c79595" CommonDataModel = "1fbeeb36-5f17-413c-809b-666fb144f157" Dates = "ade2ca70-3891-5945-98fb-dc099432e06a" DiskArrays = "3c3547ce-8d99-4f5e-a174-61eb10b00ae3" @@ -6,5 +7,6 @@ NCDatasets = "85f8d34a-cbdd-5861-8df4-14fed0d494ab" Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" [compat] +Aqua = "0.8" NCDatasets = "0.14" julia = "1" diff --git a/test/runtests.jl b/test/runtests.jl index 1f79678..63a6493 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -5,4 +5,5 @@ using ZarrDatasets include("test_cdm.jl") include("test_multifile.jl") include("test_write.jl") + include("test_aqua.jl") end diff --git a/test/test_aqua.jl b/test/test_aqua.jl new file mode 100644 index 0000000..29636c9 --- /dev/null +++ b/test/test_aqua.jl @@ -0,0 +1,4 @@ +using Aqua +using ZarrDatasets + +Aqua.test_ambiguities(ZarrDatasets)