Skip to content

Commit 8c48b70

Browse files
committed
Use proper pytest functionality for warnings and exceptions
... and let the test pass, instead of letting the test blow up and marking them as xfail.
1 parent 4e4410d commit 8c48b70

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/matplotlib/tests/test_mathtext.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -310,16 +310,16 @@ def test_mathtext_fallback_valid():
310310
mpl.rcParams['mathtext.fallback'] = fallback
311311

312312

313-
@pytest.mark.xfail
314313
def test_mathtext_fallback_invalid():
315314
for fallback in ['abc', '']:
316-
mpl.rcParams['mathtext.fallback'] = fallback
315+
with pytest.raises(ValueError, match="not a valid fallback font name"):
316+
mpl.rcParams['mathtext.fallback'] = fallback
317317

318318

319-
@pytest.mark.xfail
320319
def test_mathtext_fallback_to_cm_invalid():
321320
for fallback in [True, False]:
322-
mpl.rcParams['mathtext.fallback_to_cm'] = fallback
321+
with pytest.warns(_api.MatplotlibDeprecationWarning):
322+
mpl.rcParams['mathtext.fallback_to_cm'] = fallback
323323

324324

325325
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)