Skip to content

Conversation

@jakirkham
Copy link
Member

Previously bool just worked with Delta. However this was not actually tested. The optimized version switched to np.subtract for in-place computation, which works for other types. Though bool needs special handling. Fortunately this can be done with np.not_equal, which has the same behavior.

Also include a test for bool data to make sure this is handled correctly going forward.

TODO:

  • Unit tests and/or doctests in docstrings
  • Tests pass locally
  • Docstrings and API docs for any new/modified user-facing classes and functions
  • Changes documented in docs/release.rst
  • Docs build locally
  • GitHub Actions CI passes
  • Test coverage to 100% (Codecov passes)

Previously `bool` just worked with `Delta`. However this was not
actually tested. The optimized version switched to `np.subtract` for
in-place computation, which works for other types. Though `bool` needs
special handling. Fortunately this can be done with `np.not_equal`,
which has the same behavior.

Also include a test for `bool` data to make sure this is handled
correctly going forward.
@codecov
Copy link

codecov bot commented Oct 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.91%. Comparing base (9518e0b) to head (cf6fde0).
Report is 62 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #595   +/-   ##
=======================================
  Coverage   99.91%   99.91%           
=======================================
  Files          59       59           
  Lines        2332     2334    +2     
=======================================
+ Hits         2330     2332    +2     
  Misses          2        2           
Files with missing lines Coverage Δ
numcodecs/delta.py 100.00% <100.00%> (ø)
numcodecs/tests/test_delta.py 100.00% <ø> (ø)

@jakirkham
Copy link
Member Author

Closing and reopening to retry RTD (as it didn't run)

@jakirkham jakirkham closed this Oct 10, 2024
@jakirkham jakirkham reopened this Oct 10, 2024
@jakirkham
Copy link
Member Author

Closing and reopening as AppVeyor came up (we don't use that any more)

@jakirkham jakirkham closed this Oct 10, 2024
@jakirkham jakirkham reopened this Oct 10, 2024
This is a bit more succinct and gets to the core point. Namely
`arr.dtype` determines this code path.

Also comparing directly to `bool` works here. It is a bit faster as well
since we need not construct an `np.dtype` object.
@jakirkham
Copy link
Member Author

Sorry for the CI related noise

This is now ready! 😀

@dstansby dstansby merged commit c283106 into zarr-developers:main Oct 12, 2024
28 checks passed
@jakirkham jakirkham deleted the fix_delta_bool branch October 12, 2024 11:19
@ehgus ehgus mentioned this pull request Dec 3, 2024
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