diff --git a/_delb/plugins/core_loaders.py b/_delb/plugins/core_loaders.py index 367f7894..9872c96f 100644 --- a/_delb/plugins/core_loaders.py +++ b/_delb/plugins/core_loaders.py @@ -26,6 +26,7 @@ from io import IOBase, UnsupportedOperation from pathlib import Path from typing import TYPE_CHECKING, cast, Any +from warnings import warn from lxml import etree @@ -60,8 +61,16 @@ def etree_loader(data: Any, config: SimpleNamespace) -> LoaderResult: :class:`lxml.etree._ElementTree` instances. """ if isinstance(data, etree._ElementTree): + warn( + "lxml's etree models will not be usable inputs with the contributed core loaders.", + category=DeprecationWarning, + ) return deepcopy(data) if isinstance(data, etree._Element): + warn( + "lxml's etree models will not be usable inputs with the contributed core loaders.", + category=DeprecationWarning, + ) return etree.ElementTree( element=deepcopy(data), parser=config.parser_options._make_parser() ) diff --git a/tests/test_loaders.py b/tests/test_loaders.py index 43a8a5dc..45c65690 100644 --- a/tests/test_loaders.py +++ b/tests/test_loaders.py @@ -23,7 +23,8 @@ def test_etree_loader(): tree = etree.parse(str(TEST_FILE)) root = tree.getroot() - document = Document(root) + with pytest.deprecated_call(): + document = Document(root) assert document.root._etree_obj is not root assert document.source_url is None