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

TST: refactored xml converter test

parent ec0d5c36
No related branches found
No related tags found
2 merge requests!181Release 0.9.0,!174XML Converter
This commit is part of merge request !174. Comments created here will be created in the context of that merge request.
......@@ -83,15 +83,8 @@ def converter_registry():
return converter_registry
def test_simple_xml(converter_registry):
xml_text = """
<a href="test1" alt="no link">
test <img src="test2"/>
</a>
"""
tag = XMLTagElement("tag", lxml.etree.fromstring(xml_text))
@pytest.fixture
def basic_cfood():
xml_cfood = yaml.safe_load("""
type: XMLTag
match_tag: a
......@@ -114,10 +107,33 @@ subtree:
match_name: alt
match_value: ^(?P<text>.*)$
""")
return xml_cfood
@pytest.fixture
def basic_xmltag_converter(basic_cfood, converter_registry):
converter = XMLTagConverter(basic_cfood, "TestXMLTagConverter", converter_registry)
return converter
converter = XMLTagConverter(xml_cfood, "TestXMLTagConverter", converter_registry)
m = converter.match(tag)
def test_simple_xml(basic_xmltag_converter):
"""
Test for basic xml conversion functionality.
"""
xml_text = """
<a href="test1" alt="no link">
test <img src="test2"/>
</a>
"""
tag = XMLTagElement("tag", lxml.etree.fromstring(xml_text))
m = basic_xmltag_converter.match(tag)
assert m is not None
assert m["ref"] == "href"
assert m["number"] == "1"
def test_not_matching(basic_xmltag_converter):
pass
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment