Skip to content

Commit

Permalink
TST: Update for pytest 7
Browse files Browse the repository at this point in the history
Remove 36 PytestRemovedIn8Warning and PytestReturnNotNoneWarning warnings.
  • Loading branch information
StefRe committed Oct 25, 2023
1 parent 27a2d22 commit 44d5441
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
2 changes: 1 addition & 1 deletion probscale/tests/test_algo.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ def test__bs_fit(plot_data, fitlogs, known_lo, known_hi):


class Test__estimate_from_fit(object):
def setup(self):
def setup_method(self):
self.x = numpy.arange(1, 11, 0.5)
self.slope = 2
self.intercept = 3.5
Expand Down
9 changes: 5 additions & 4 deletions probscale/tests/test_probscale.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
import warnings

import numpy
import matplotlib.pyplot as plt
Expand Down Expand Up @@ -120,16 +121,16 @@ def test_minimal_norm_cdf(mn, mn_input):


def test_sign_with_nan_no_warning(mn):
with pytest.warns(None) as record:
with warnings.catch_warnings():
warnings.simplefilter("error")
res = mn._approx_erf(numpy.nan)
assert not record
assert numpy.isnan(res)


def test_sign_with_nan_no_warning_inv(mn):
with pytest.warns(None) as record:
with warnings.catch_warnings():
warnings.simplefilter("error")
res = mn._approx_inv_erf(numpy.nan)
assert not record
assert numpy.isnan(res)


Expand Down
6 changes: 2 additions & 4 deletions probscale/tests/test_viz.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def plot_data():


class Test_fit_line(object):
def setup(self):
def setup_method(self):
self.data = numpy.array(
[
2.00,
Expand Down Expand Up @@ -454,7 +454,7 @@ def test_custom_xhat(self):


class Test_plot_pos(object):
def setup(self):
def setup_method(self):
self.data = numpy.arange(16)

self.known_type4 = numpy.array(
Expand Down Expand Up @@ -740,7 +740,6 @@ def test_probplot_prob(plot_data):
fig, ax = plt.subplots()
fig = viz.probplot(plot_data, ax=ax, problabel="Test xlabel", datascale="log")
assert isinstance(fig, plt.Figure)
return fig


@pytest.mark.mpl_image_compare(baseline_dir=BASELINE_DIR, tolerance=TIGHT_TOLERANCE)
Expand Down Expand Up @@ -1026,7 +1025,6 @@ def test_probplot_test_results(plot_data):
assert isinstance(results, dict)
known_keys = sorted(["q", "x", "y", "xhat", "yhat", "res"])
assert sorted(list(results.keys())) == known_keys
return fig


@pytest.mark.parametrize("probax", ["x", "y"])
Expand Down

0 comments on commit 44d5441

Please sign in to comment.