Skip to content

Commit 84801e4

Browse files
better handle mixed type attributes
1 parent fb47104 commit 84801e4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

test/test_write.jl

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
using Test
12
using ZarrDatasets
23
using ZarrDatasets:
34
defDim,
@@ -7,13 +8,14 @@ data = rand(Int32,3,5)
78

89
fname = tempname()
910
mkdir(fname)
10-
gattrib = Dict{String,Any}("title" => "this is the title")
11+
gattrib = Dict("title" => "this is the title")
1112
ds = ZarrDataset(fname,"c",attrib = gattrib)
1213

14+
ds.attrib["number"] = 1
1315
defDim(ds,"lon",3)
1416
defDim(ds,"lat",5)
1517

16-
attrib = Dict{String,Any}(
18+
attrib = Dict(
1719
"units" => "m/s",
1820
"long_name" => "test",
1921
)
@@ -25,7 +27,7 @@ vtype = Int32
2527

2628
zv = defVar(ds,varname,vtype,dimensionnames, attrib = attrib)
2729
zv[:,:] = data
28-
zv.attrib["lala"] = 12
30+
zv.attrib["number"] = 12
2931
zv.attrib["standard_name"] = "test"
3032
ds.attrib["history"] = "test"
3133
close(ds)
@@ -34,7 +36,7 @@ ds = ZarrDataset(fname)
3436

3537
zv = ds[varname]
3638

37-
@test zv.attrib["lala"] == 12
39+
@test zv.attrib["number"] == 12
3840
@test zv.attrib["standard_name"] == "test"
3941
@test ds.attrib["history"] == "test"
4042

0 commit comments

Comments
 (0)