astrofrog / astrofrog/fast-histogram

test_1d_compare_with_numpy fails with numpy 2.2

Open
#92 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
281
Forks
28
PR merge metrics
No merged PRs in 30d

Description

In Debian, we are transitioning to numpy 2.2, and observe the following test failure:
```python

__________________________ test_1d_compare_with_numpy __________________________

@given(
> size=st.integers(0, 50),
nx=st.integers(1, 10),
xmin=st.floats(-1e10, 1e10),
xmax=st.floats(-1e10, 1e10),
weights=st.booleans(),
dtype=st.sampled_from([">f4", "f8", "= bin_edges[1:]):
> raise ValueError(
f'Too many bins for data range. Cannot create {n_equal_bins} '
f'finite-sized bins.')
E ValueError: Too many bins for data range. Cannot create 2 finite-sized bins.
E Falsifying example: test_1d_compare_with_numpy(
E # The test sometimes passed when commented parts were varied together.
E size=0, # or any other generated value
E nx=2,
E xmin=-5e-324,
E xmax=0.0,
E weights=False, # or any other generated value
E dtype='>f8', # or any other generated value
E )
E Explanation:
E These lines were always and only run by failing examples:
E /usr/lib/python3/dist-packages/numpy/_core/function_base.py:155

/usr/lib/python3/dist-packages/numpy/lib/_histograms_impl.py:453: ValueError
```
This was reported as [Debian#1094732](https://bugs.debian.org/1094732). This looks to me like a problem with the test code and not with the operational code, so I will disable the test for the moment in the Debian build.

Contributor guide

No contributing guide indexed for this repository

Research direction

The failure is in fast_histogram/tests/test_histogram.py, in test_1d_compare_with_numpy; start by reproducing it with NumPy 2.2 and inspect the generated boundary case. Determine how the test should handle this NumPy behavior, then run the test to confirm the comparison test no longer fails.

Written by the indexing model from the issue text.

Assessment

Tech stack
numpy, python
Domain
testing-qa
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.