Skip to content
Snippets Groups Projects
Commit 3bb7861a authored by Alexander Schlemmer's avatar Alexander Schlemmer
Browse files

TST: adapted tests to new xml converter

parent 0ddc150f
No related branches found
No related tags found
2 merge requests!181Release 0.9.0,!174XML Converter
Pipeline #54371 failed
......@@ -134,8 +134,9 @@ def test_simple_xml(basic_xmltag_converter):
"""
xml = fromstring(xml_text)
tag = XMLTagElement(xml)
assert tag.name == "."
tag = XMLTagElement(xml.getroot(), xml)
m = basic_xmltag_converter.match(tag)
assert m is not None
......@@ -145,7 +146,7 @@ def test_simple_xml(basic_xmltag_converter):
def test_not_matching(basic_xmltag_converter):
m = basic_xmltag_converter.match(XMLTagElement("tag", fromstring("""
m = basic_xmltag_converter.match(XMLTagElement(fromstring("""
<a href="test1">
test <img src="test2"/>
</a>
......@@ -153,7 +154,7 @@ def test_not_matching(basic_xmltag_converter):
assert m is None # alt-attribute was missing
m = basic_xmltag_converter.match(XMLTagElement("tag", fromstring("""
m = basic_xmltag_converter.match(XMLTagElement(fromstring("""
<a href="test" alt="no link">
test <img src="test2"/>
</a>
......@@ -161,7 +162,7 @@ def test_not_matching(basic_xmltag_converter):
assert m is None # href attribute did not match
m = basic_xmltag_converter.match(XMLTagElement("tag", fromstring("""
m = basic_xmltag_converter.match(XMLTagElement(fromstring("""
<a href="test1" url="http" alt="no link">
test <img src="test2"/>
</a>
......@@ -169,13 +170,13 @@ def test_not_matching(basic_xmltag_converter):
assert m is None # href and url must not be present simultaneously
m = basic_xmltag_converter.match(XMLTagElement("tag", fromstring("""
m = basic_xmltag_converter.match(XMLTagElement(fromstring("""
<a href="test1" alt="no link"><img src="test2"/></a>
""")))
assert m is None # text node is empty
m = basic_xmltag_converter.match(XMLTagElement("tag", fromstring("""
m = basic_xmltag_converter.match(XMLTagElement(fromstring("""
<a href="test1" alt="no link"/>
""")))
......@@ -197,7 +198,7 @@ def test_nested_simple_xml(basic_xmltag_converter):
</a>
"""
tag = XMLTagElement("tag", fromstring(xml_text))
tag = XMLTagElement(fromstring(xml_text))
m = basic_xmltag_converter.match(tag)
assert m is not None
......@@ -207,4 +208,4 @@ def test_nested_simple_xml(basic_xmltag_converter):
assert len(children) == 1
assert isinstance(children[0], XMLTagElement)
assert children.name == "/a/img"
assert children[0].name == "img"
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment