From 26bd3dc23f9072ed06e1d005d2fb75d4cb876399 Mon Sep 17 00:00:00 2001 From: Johannes Nussbaum <39048939+jnussbaum@users.noreply.github.com> Date: Fri, 18 Oct 2024 14:05:01 +0200 Subject: [PATCH] fix: add missing dependency in xmllib (DEV-4254) (#1228) --- pyproject.toml | 1 + test/distribution/test_xmllib.py | 22 ++++++++++++++++++++++ uv.lock | 2 ++ 3 files changed, 25 insertions(+) create mode 100644 test/distribution/test_xmllib.py diff --git a/pyproject.toml b/pyproject.toml index c8b285d939..acfbebf6da 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -32,6 +32,7 @@ dependencies = [ "rustworkx>=0.15.1", "termcolor>=2.4.0", "tqdm>=4.66.5", + "typing-extensions>=4.12.2", ] diff --git a/test/distribution/test_xmllib.py b/test/distribution/test_xmllib.py new file mode 100644 index 0000000000..07aa88c22b --- /dev/null +++ b/test/distribution/test_xmllib.py @@ -0,0 +1,22 @@ +from dsp_tools.xmllib.models.dsp_base_resources import AnnotationResource +from dsp_tools.xmllib.models.resource import Resource +from dsp_tools.xmllib.models.root import XMLRoot +from dsp_tools.xmllib.value_checkers import is_bool_like +from dsp_tools.xmllib.value_converters import convert_to_bool_string + + +def test_xmllib() -> None: + """ + This does NOT test the xmllib. + This only tests if all dependencies used in the xmllib are shipped in the distribution. + For this purpose, it is enough to import all modules of the xmllib. + Indirect imports are okay, too, i.e. modules that are imported by modules that are imported here. + """ + root = XMLRoot("0000", "my_onto") + my_res = Resource.new("my_res", "restype", "label") + if is_bool_like("0"): + my_res.add_bool(convert_to_bool_string("0"), "my_prop") + my_res.add_file("my_file") + annotation = AnnotationResource.new("res_id", "label", "annotation_of", ["comment1", "comment2"]) + root.add_resource(annotation) # type: ignore[arg-type] + root.add_resource(my_res) diff --git a/uv.lock b/uv.lock index 8452645801..bf59bd6015 100644 --- a/uv.lock +++ b/uv.lock @@ -220,6 +220,7 @@ dependencies = [ { name = "rustworkx" }, { name = "termcolor" }, { name = "tqdm" }, + { name = "typing-extensions" }, ] [package.dev-dependencies] @@ -272,6 +273,7 @@ requires-dist = [ { name = "rustworkx", specifier = ">=0.15.1" }, { name = "termcolor", specifier = ">=2.4.0" }, { name = "tqdm", specifier = ">=4.66.5" }, + { name = "typing-extensions", specifier = ">=4.12.2" }, ] [package.metadata.requires-dev]