Skip to content

streamline create_and_fill helper function in tests - #353

Merged
lazarusA merged 3 commits into
JuliaIO:mainfrom
tiemvanderdeure:streamline_creatandfill
Oct 3, 2026
Merged

lazarusA merged 3 commits into
JuliaIO:mainfrom
tiemvanderdeure:streamline_creatandfill

Conversation

@tiemvanderdeure

Copy link
Copy Markdown
Contributor

replace repeated if x !== nothing checks with a single filter(!isnothing, nt)

@lazarusA

lazarusA commented Oct 1, 2026

Copy link
Copy Markdown
Member

the only real issue seems to be lts,

ERROR: LoadError: MethodError: no method matching filter(::ComposedFunction{typeof(!), typeof(isnothing)}, ::@NamedTuple{name::String, dtype::String, shape::Tuple{Int64}, chunks::Tuple{Int64}, serializer::Py})
  
  Closest candidates are:
    filter(::Any, !Matched::Array{T, N}) where {T, N}
     @ Base array.jl:2670
    filter(::Any, !Matched::Union{SubString{String}, String})
     @ Base strings/substring.jl:279
    filter(::Any, !Matched::AbstractString)
     @ Base strings/basic.jl:666
    ...
  
  Stacktrace:
   [1] create_and_fill(store::Py; data::Vector{Int64}, compressors::Vector{Py}, kw::@Kwargs{name::String, dtype::String, shape::Tuple{Int64}, chunks::Tuple{Int64}, serializer::Py})
     @ Main ~/work/Zarr.jl/Zarr.jl/Zarr/test/v3_python.jl:44
   [2] top-level scope
     @ ~/work/Zarr.jl/Zarr.jl/Zarr/test/v3_python.jl:58
  in expression starting at /home/runner/work/Zarr.jl/Zarr.jl/Zarr/test/v3_python.jl:58

@tiemvanderdeure

Copy link
Copy Markdown
Contributor Author

my bad, filter on namedtuples was added in 1.11

@tiemvanderdeure

Copy link
Copy Markdown
Contributor Author

I'm quite tempted to put these repeated calls to the same function for 500 lines in some nested loops, but it's probably nice to see the line number when there are test failures

@felixcremer

Copy link
Copy Markdown
Member

I'm quite tempted to put these repeated calls to the same function for 500 lines in some nested loops, but it's probably nice to see the line number when there are test failures

Do it. As I see it, that is only the testdata generation and I would be more interested in the actual line numbers for the tests and not the test data generation.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@lazarusA

lazarusA commented Oct 1, 2026

Copy link
Copy Markdown
Member

I think to some degree, something similar could be done to https://github.com/JuliaIO/Zarr.jl/blob/main/Zarr/test/v3_julia.jl

@lazarusA
lazarusA merged commit b4bed4f into JuliaIO:main Oct 3, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants