Skip to content

Commit

Permalink
FIX: small fixes to make unit tests pass
Browse files Browse the repository at this point in the history
This is preparation for migration to numpy>2 and pandas>2.
  • Loading branch information
kx79wq committed Dec 7, 2024
1 parent 2a70935 commit 5b9f67c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
python: [3.8, 3.9, 3.10,13, 3.11, 3.12]
python: [3.8, 3.9, 3.10, 3.11, 3.12]
runs-on: ${{ matrix.os }}

steps:
Expand Down
2 changes: 1 addition & 1 deletion histogrammar/primitives/sparselybin.py
Original file line number Diff line number Diff line change
Expand Up @@ -657,7 +657,7 @@ def __repr__(self):

def __eq__(self, other):
return isinstance(other, SparselyBin) and numeq(self.binWidth, other.binWidth) and \
self.quantity == other.quantity and numeq(self.entries, other.entries) and self.bins == other.bins and \
self.quantity == other.quantity and numeq(self.entries, other.entries) and sorted(self.bins) == sorted(other.bins) and \
self.nanflow == other.nanflow and numeq(self.origin, other.origin)

def __ne__(self, other):
Expand Down
5 changes: 5 additions & 0 deletions tests/test_numpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,9 @@ def compare(self, name, hnp, npdata, hpy, pydata):
startTime = time.time()
hnp.fill.numpy(npdata)
numpyTime = time.time() - startTime
# protect against zero time.
numpyTime = max(numpyTime, 1e-10)


if pydata.dtype != numpy.unicode_:
for key in npdata:
Expand All @@ -261,6 +264,8 @@ def compare(self, name, hnp, npdata, hpy, pydata):
d = float(d)
hpy.fill(d)
pyTime = time.time() - startTime
# protect against zero time.
pyTime = max(pyTime, 1e-10)

for h in [hpy2, hpy3, hpy3]:
for d in pydata:
Expand Down

0 comments on commit 5b9f67c

Please sign in to comment.