From 43aed52ca0dbf20372f41d22a384f5f598fea759 Mon Sep 17 00:00:00 2001 From: David McKee Date: Thu, 7 Sep 2023 16:39:29 +0100 Subject: [PATCH] Add forgotten test helper --- tests/client_helpers/test_xml_helpers.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 tests/client_helpers/test_xml_helpers.py diff --git a/tests/client_helpers/test_xml_helpers.py b/tests/client_helpers/test_xml_helpers.py new file mode 100644 index 00000000..fe5f4f66 --- /dev/null +++ b/tests/client_helpers/test_xml_helpers.py @@ -0,0 +1,15 @@ +import lxml.etree + +from caselawclient.xml_helpers import get_xpath_match_string, get_xpath_match_strings + + +def test_xpath_single(): + node = lxml.etree.fromstring("12") + path = "//cat/text()" + assert get_xpath_match_string(node, path) == "1" + + +def test_xpath_multiple(): + node = lxml.etree.fromstring("12") + path = "//cat/text()" + assert get_xpath_match_strings(node, path) == ["1", "2"]