Skip to content

Commit ac4d776

Browse files
Merge pull request #17857 from neutrinoceros/modeling/test/avoid_matching_empty_strings
TST: avoid non-falsifiable matches (`match=''`) in `pytest.raises`
2 parents 7547cfc + cd1c4b0 commit ac4d776

2 files changed

Lines changed: 6 additions & 3 deletions

File tree

astropy/modeling/tests/test_models.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -923,15 +923,18 @@ def test_tabular1d_inverse():
923923
points = np.arange(5)
924924
values = np.array([1.5, 3.4, 3.4, 32, 25])
925925
t = models.Tabular1D(points, values)
926-
with pytest.raises(NotImplementedError, match=r""):
926+
with pytest.raises(NotImplementedError, match=r"^$"):
927927
t.inverse((3.4, 7.0))
928928

929929
# Check that Tabular2D.inverse raises an error
930930
table = np.arange(5 * 5).reshape(5, 5)
931931
points = np.arange(0, 5)
932932
points = (points, points)
933933
t3 = models.Tabular2D(points=points, lookup_table=table)
934-
with pytest.raises(NotImplementedError, match=r""):
934+
with pytest.raises(
935+
NotImplementedError,
936+
match=r"An analytical inverse transform has not been implemented for this model\.",
937+
):
935938
t3.inverse((3, 3))
936939

937940
# Check that it uses the same kwargs as the original model

tox.ini

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ deps =
6969
mpl360: numpy<2.0
7070

7171
image: latex
72-
image: scipy
72+
image, devinfra: scipy
7373
image: pytest-mpl>=0.17
7474

7575
# Some FITS tests use fitsio as a comparison

0 commit comments

Comments
 (0)