@@ -216,7 +216,8 @@ def test_legacy_custom_required_reference() -> None:
216216 """Check that external HTML-based references are expanded or reported missing."""
217217 url_map = {"ok" : "ok.html#ok" }
218218 source = "<span data-autorefs-identifier=bar>foo</span> <span data-autorefs-identifier=ok>ok</span>"
219- output , unmapped = fix_refs (source , url_map .__getitem__ )
219+ with pytest .warns (DeprecationWarning , match = "`span` elements are deprecated" ):
220+ output , unmapped = fix_refs (source , url_map .__getitem__ )
220221 assert output == '[foo][bar] <a class="autorefs autorefs-internal" href="ok.html#ok">ok</a>'
221222 assert unmapped == ["bar" ]
222223
@@ -234,7 +235,8 @@ def test_legacy_custom_optional_reference() -> None:
234235 """Check that optional HTML-based references are expanded and never reported missing."""
235236 url_map = {"ok" : "ok.html#ok" }
236237 source = '<span data-autorefs-optional="bar">foo</span> <span data-autorefs-optional=ok>ok</span>'
237- output , unmapped = fix_refs (source , url_map .__getitem__ )
238+ with pytest .warns (DeprecationWarning , match = "`span` elements are deprecated" ):
239+ output , unmapped = fix_refs (source , url_map .__getitem__ )
238240 assert output == 'foo <a class="autorefs autorefs-internal" href="ok.html#ok">ok</a>'
239241 assert unmapped == []
240242
@@ -252,7 +254,8 @@ def test_legacy_custom_optional_hover_reference() -> None:
252254 """Check that optional-hover HTML-based references are expanded and never reported missing."""
253255 url_map = {"ok" : "ok.html#ok" }
254256 source = '<span data-autorefs-optional-hover="bar">foo</span> <span data-autorefs-optional-hover=ok>ok</span>'
255- output , unmapped = fix_refs (source , url_map .__getitem__ )
257+ with pytest .warns (DeprecationWarning , match = "`span` elements are deprecated" ):
258+ output , unmapped = fix_refs (source , url_map .__getitem__ )
256259 assert (
257260 output
258261 == '<span title="bar">foo</span> <a class="autorefs autorefs-internal" title="ok" href="ok.html#ok">ok</a>'
@@ -276,7 +279,8 @@ def test_legacy_external_references() -> None:
276279 """Check that external references are marked as such."""
277280 url_map = {"example" : "https://example.com" }
278281 source = '<span data-autorefs-optional="example">example</span>'
279- output , unmapped = fix_refs (source , url_map .__getitem__ )
282+ with pytest .warns (DeprecationWarning , match = "`span` elements are deprecated" ):
283+ output , unmapped = fix_refs (source , url_map .__getitem__ )
280284 assert output == '<a class="autorefs autorefs-external" href="https://example.com">example</a>'
281285 assert unmapped == []
282286
@@ -382,7 +386,8 @@ def test_legacy_keep_data_attributes() -> None:
382386 """Keep HTML data attributes from autorefs spans."""
383387 url_map = {"example" : "https://e.com" }
384388 source = '<span data-autorefs-optional="example" class="hi ho" data-foo data-bar="0">e</span>'
385- output , _ = fix_refs (source , url_map .__getitem__ )
389+ with pytest .warns (DeprecationWarning , match = "`span` elements are deprecated" ):
390+ output , _ = fix_refs (source , url_map .__getitem__ )
386391 assert output == '<a class="autorefs autorefs-external hi ho" href="https://e.com" data-foo data-bar="0">e</a>'
387392
388393
0 commit comments