diff --git a/tests/test_references.py b/tests/test_references.py index e1db89f..649b54b 100644 --- a/tests/test_references.py +++ b/tests/test_references.py @@ -222,84 +222,80 @@ def test_reference_with_markup() -> None: def test_legacy_custom_required_reference() -> None: """Check that external HTML-based references are expanded or reported missing.""" - url_map = {"ok": "ok.html#ok"} - source = "foo ok" with pytest.warns(DeprecationWarning, match="`span` elements are deprecated"): - output, unmapped = fix_refs(source, url_map.__getitem__) - assert output == '[foo][bar] ok' - assert unmapped == [("bar", None)] + run_references_test( + url_map={"ok": "ok.html#ok"}, + source="foo ok", + output='
[foo][bar] ok
', + unmapped=[("bar", None)], + ) def test_custom_required_reference() -> None: """Check that external HTML-based references are expanded or reported missing.""" - url_map = {"ok": "ok.html#ok"} - source = "[foo][bar] ok
', + unmapped=[("bar", None)], + ) def test_legacy_custom_optional_reference() -> None: """Check that optional HTML-based references are expanded and never reported missing.""" - url_map = {"ok": "ok.html#ok"} - source = 'foo ok' with pytest.warns(DeprecationWarning, match="`span` elements are deprecated"): - output, unmapped = fix_refs(source, url_map.__getitem__) - assert output == 'foo ok' - assert unmapped == [] + run_references_test( + url_map={"ok": "ok.html#ok"}, + source='foo ok', + output='foo ok
', + ) def test_custom_optional_reference() -> None: """Check that optional HTML-based references are expanded and never reported missing.""" - url_map = {"ok": "ok.html#ok"} - source = 'foo ok
', + ) def test_legacy_custom_optional_hover_reference() -> None: """Check that optional-hover HTML-based references are expanded and never reported missing.""" - url_map = {"ok": "ok.html#ok"} - source = 'foo ok' with pytest.warns(DeprecationWarning, match="`span` elements are deprecated"): - output, unmapped = fix_refs(source, url_map.__getitem__) - assert ( - output - == 'foo ok' - ) - assert unmapped == [] + run_references_test( + url_map={"ok": "ok.html#ok"}, + source='foo ok', + output='foo ok
', + ) def test_custom_optional_hover_reference() -> None: """Check that optional-hover HTML-based references are expanded and never reported missing.""" - url_map = {"ok": "ok.html#ok"} - source = 'foo ok
', ) - assert unmapped == [] def test_legacy_external_references() -> None: """Check that external references are marked as such.""" - url_map = {"example": "https://example.com"} - source = 'example' with pytest.warns(DeprecationWarning, match="`span` elements are deprecated"): - output, unmapped = fix_refs(source, url_map.__getitem__) - assert output == 'example' - assert unmapped == [] + run_references_test( + url_map={"example": "https://example.com/#example"}, + source='example', + output='', + ) def test_external_references() -> None: """Check that external references are marked as such.""" - url_map = {"example": "https://example.com"} - source = '