From e84b9f1c0f129209b8ef911ff7eca11e0a1f5981 Mon Sep 17 00:00:00 2001 From: Constantin Hong Date: Wed, 8 May 2024 00:04:02 +0900 Subject: [PATCH] tests/test_xpath_selector_unit/test: Fix --- changedetectionio/tests/test_xpath_selector_unit.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/changedetectionio/tests/test_xpath_selector_unit.py b/changedetectionio/tests/test_xpath_selector_unit.py index 315a50fb..e3ea3894 100644 --- a/changedetectionio/tests/test_xpath_selector_unit.py +++ b/changedetectionio/tests/test_xpath_selector_unit.py @@ -234,9 +234,10 @@ def test_trips(html_content, xpath, answer): import elementpath from elementpath.xpath3 import XPath3Parser parser = etree.HTMLParser() - tree = html.fromstring(bytes(doc, encoding='utf-8'), parser=parser) + tree = html.fromstring(bytes(html_content, encoding='utf-8'), parser=parser) + # just example xpath # Error will occur. - r = elementpath.select(tree, path.strip(), namespaces={'re': 'http://exslt.org/regular-expressions'}, parser=XPath3Parser) + r = elementpath.select(tree, xpath.strip(), namespaces={'re': 'http://exslt.org/regular-expressions'}, parser=XPath3Parser) html_content = html_tools.xpath_filter(xpath, html_content, append_pretty_line_formatting=True) assert type(html_content) == str