Skip to content

Commit

Permalink
[bugfix]: changning pytest to be compatible with numpy 2.0 requiremen…
Browse files Browse the repository at this point in the history
…t that np.NaN be np.nan
  • Loading branch information
mscaudill committed Dec 6, 2024
1 parent eb7ebed commit 9e8c62b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 1 addition & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,18 @@ def written_data(demo_data):
with edf.Reader(demo_data) as reader:
with edf.Writer(fp) as writer:
writer.write(reader.header, reader, channels=channels)

return fp

@pytest.fixture(scope='session')
def irregular_written_data(demo_data):
""" """


# The edf will contain 200 data records with varying samples per record
# for the different channels
seed = 0
nrecords = 200
samples_per_record = [5000, 10000, 20000, 5000]
pad_value = np.NaN
pad_value = np.nan

# create random data array to write
rng = np.random.default_rng(seed)
Expand Down
4 changes: 2 additions & 2 deletions tests/test_edf.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ def test_irr_randomread(irregular_written_data):
fp, written = irregular_written_data
with openEDF(fp) as reader:
for start, stop in zip(starts, stops):
arr = reader.read(start, stop, padvalue=np.NaN)
arr = reader.read(start, stop, padvalue=np.nan)
x = written[:, start:stop]
assert np.allclose(arr, x, equal_nan=True, atol=1)

Expand All @@ -244,7 +244,7 @@ def test_irr_random_chread(irregular_written_data):
with openEDF(fp) as reader:
reader.channels = channels
for start, stop in zip(starts, stops):
arr = reader.read(start, stop, padvalue=np.NaN)
arr = reader.read(start, stop, padvalue=np.nan)
x = written[channels, start:stop]
#imprecision due to 2-byte conversion so tolerance set to 1 unit
assert np.allclose(arr, x, equal_nan=True, atol=1)
Expand Down

0 comments on commit 9e8c62b

Please sign in to comment.