Skip to content

Commit 89308ef

Browse files
update tests
1 parent 026226e commit 89308ef

File tree

2 files changed

+17
-12
lines changed

2 files changed

+17
-12
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ ds_sub = @select(ds, time == DateTime(2001,1,1)
4646
&& 7 <= longitude <= 11
4747
&& 42.3 <= latitude <= 44.5)
4848

49-
# save selection as NetCDF file
49+
# save selection as a NetCDF file
5050
NCDataset("$(dataset_id)_selection.nc","c") do ds_nc
5151
write(ds_nc,ds_sub)
5252
end

test/runtests.jl

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ using CommonDataModel: iswritable, attribnames, parentdataset
2222
close(ds)
2323

2424
ds = NCDataset(nczarr_name)
25-
ds2 = ZarrDataset(fname)
25+
dsz = ZarrDataset(fname)
2626

27-
@test Set(dimnames(ds2)) == Set(dimnames(ds))
27+
@test Set(dimnames(dsz)) == Set(dimnames(ds))
2828

2929
for (name,len) in ds.dim
30-
@test ds2.dim[name] == len
30+
@test dsz.dim[name] == len
3131
end
3232

3333
for (varname,v) in ds
34-
@test haskey(ds2,varname)
34+
@test haskey(dsz,varname)
3535

36-
v2 = ds2[varname]
36+
v2 = dsz[varname]
3737
@test Array(v2) == Array(v)
3838

3939
for (attribname,attribval) in v.attrib
@@ -42,18 +42,23 @@ using CommonDataModel: iswritable, attribnames, parentdataset
4242
end
4343

4444
for (attribname,attribval) in ds.attrib
45-
@test ds2.attrib[attribname] == attribval
45+
@test dsz.attrib[attribname] == attribval
4646
end
4747

4848
io = IOBuffer()
49-
show(io,ds)
49+
show(io,dsz)
5050
str = String(take!(io))
5151
@test occursin("title",str)
5252

53-
@test !iswritable(ds)
54-
@test "title" in attribnames(ds)
55-
@test isnothing(parentdataset(ds))
53+
@test !iswritable(dsz)
54+
@test "title" in attribnames(dsz)
55+
@test isnothing(parentdataset(dsz))
5656

57+
zvar = ZarrDataset(fname) do ds3
58+
Array(ds3["var"])
59+
end
60+
61+
@test zvar == Array(ds["var"])
5762
close(ds)
58-
close(ds2)
63+
close(dsz)
5964
end

0 commit comments

Comments
 (0)