Skip to content

Commit 333b4d7

Browse files
nhz2mkitti
andauthored
Fix reading complex type and add basic round trip test (#181)
* Fix reading complex type * Fix formatting of array assignment in python.jl to retrigger CI * try to fix coveralls * Update test/python.jl Co-authored-by: Mark Kittisopikul <[email protected]> --------- Co-authored-by: Mark Kittisopikul <[email protected]>
1 parent 27d424a commit 333b4d7

File tree

3 files changed

+30
-8
lines changed

3 files changed

+30
-8
lines changed

.github/workflows/CI.yml

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,18 @@ jobs:
4141
with:
4242
files: lcov.info
4343
token: ${{ secrets.CODECOV_TOKEN }}
44-
- uses: coverallsapp/github-action@master
44+
- uses: coverallsapp/github-action@v2
4545
with:
4646
github-token: ${{ secrets.GITHUB_TOKEN }}
47-
path-to-lcov: ./lcov.info
47+
files: lcov.info
48+
flag-name: run-${{ join(matrix.*, '-') }}
49+
parallel: true
50+
finish:
51+
needs: test
52+
if: ${{ always() }}
53+
runs-on: ubuntu-latest
54+
steps:
55+
- name: Coveralls Finished
56+
uses: coverallsapp/github-action@v2
57+
with:
58+
parallel-finished: true

src/metadata.jl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ const typemap = Dict{Tuple{Char, Int}, DataType}(
4444
('U', 1) => Char,
4545
)
4646
sizemapf(x::Type{<:Number}) = sizeof(x)
47-
sizemapf(x::Type{<:Complex{T}}) where T = sizeof(T)
4847
typecharf(::Type{<:Signed}) = 'i'
4948
typecharf(::Type{<:Unsigned}) = 'u'
5049
typecharf(::Type{<:AbstractFloat}) = 'f'

test/python.jl

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ numeric_dtypes = (UInt8, UInt16, UInt32, UInt64,
3232
dtypes = (numeric_dtypes...,
3333
MaxLengthString{10,UInt8},MaxLengthString{10,UInt32},
3434
String)
35+
dtypesp = ("uint8","uint16","uint32","uint64",
36+
"int8","int16","int32","int64",
37+
"float16","float32","float64",
38+
"complex64", "complex128","bool","S10","U10", "O")
3539
compressors = (
3640
"no"=>NoCompressor(),
3741
"blosc"=>BloscCompressor(cname="zstd"),
@@ -81,6 +85,19 @@ open(pjulia*".zip";write=true) do io
8185
Zarr.writezip(io, g)
8286
end
8387

88+
@testset "reading in julia" begin
89+
g = zopen(pjulia)
90+
#Test group attributes
91+
@test g.attrs == groupattrs
92+
for (t, co) in Iterators.product(dtypes, compressors)
93+
compstr,comp = co
94+
arname = string("a",t,compstr)
95+
ar = g[arname]
96+
@test ar.attrs == Dict("This is a nested attribute"=>Dict("a"=>5))
97+
@test ar == testarrays[t]
98+
end
99+
end
100+
84101
# Test reading in python
85102
for julia_path in (pjulia, pjulia*".zip")
86103
g = zarr.open_group(julia_path)
@@ -91,11 +108,6 @@ for julia_path in (pjulia, pjulia*".zip")
91108
@test gatts["Int attribute"] == 5
92109
@test gatts["Float attribute"] == 10.5
93110

94-
dtypesp = ("uint8","uint16","uint32","uint64",
95-
"int8","int16","int32","int64",
96-
"float16","float32","float64",
97-
"complex64", "complex128","bool","S10","U10", "O")
98-
99111
#Test accessing arrays from python and reading data
100112
for i=1:length(dtypes), co in compressors
101113
compstr,comp = co

0 commit comments

Comments
 (0)