Skip to content

Commit

Permalink
Modify type test for compatibility with Python 3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
tennlee committed Aug 25, 2024
1 parent ec8d555 commit fb2a49a
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/categorical/test_binary.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def test_pod_dask():
result = probability_of_detection(fcst_mix.chunk(), obs1.chunk())
assert isinstance(result.data, dask.array.Array)
result = result.compute()
assert isinstance(result.data, np.ndarray | np.generic)
assert isinstance(result.data, (np.ndarray, np.generic))
xr.testing.assert_equal(result, expected_pod3)


Expand Down Expand Up @@ -134,7 +134,7 @@ def test_pofd_dask():
result = probability_of_false_detection(fcst_mix.chunk(), obs0.chunk())
assert isinstance(result.data, dask.array.Array)
result = result.compute()
assert isinstance(result.data, np.ndarray | np.generic)
assert isinstance(result.data, (np.ndarray, np.generic))
xr.testing.assert_equal(result, expected_pofd3)


Expand Down
2 changes: 1 addition & 1 deletion tests/categorical/test_contingency.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ def test_dask_if_available_categorical():

# And that transformed tables are built out of computed things
simple_counts = table.transform().get_counts()
assert isinstance(simple_counts["tp_count"].data, np.ndarray | np.generic)
assert isinstance(simple_counts["tp_count"].data, (np.ndarray, np.generic))

# And that transformed things get the same numbers
assert table.false_alarm_rate() == table.transform().false_alarm_rate()
Expand Down
2 changes: 1 addition & 1 deletion tests/continuous/test_correlation.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,5 +101,5 @@ def test_correlation_dask():
result = pearsonr(DA3_CORR.chunk(), DA2_CORR.chunk())
assert isinstance(result.data, dask.array.Array)
result = result.compute()
assert isinstance(result.data, np.ndarray | np.generic)
assert isinstance(result.data, (np.ndarray, np.generic))
xr.testing.assert_allclose(result, EXP_CORR_REDUCE_ALL)
2 changes: 1 addition & 1 deletion tests/continuous/test_flip_flop.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def test_flip_flop_index_is_dask_compatible():
assert isinstance(result.data, dask.array.Array)
result = result.compute()
xr.testing.assert_allclose(result, ntd.EXP_FFI_SUB_CASE0)
assert isinstance(result.data, np.ndarray | np.generic)
assert isinstance(result.data, (np.ndarray, np.generic))


def test_flip_flop_index_proportion_exceeding_is_dask_compatible():
Expand Down
2 changes: 1 addition & 1 deletion tests/probabilty/test_brier.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ def test_brier_score_dask():
result = brier_score(FCST1.chunk(), OBS1.chunk())
assert isinstance(result.data, dask.array.Array)
result = result.compute()
assert isinstance(result.data, np.ndarray | np.generic)
assert isinstance(result.data, (np.ndarray, np.generic))
xr.testing.assert_equal(result, xr.DataArray(0.1))


Expand Down

0 comments on commit fb2a49a

Please sign in to comment.