Skip to content

Commit 3a35b47

Browse files
add extra coverage for junit test helpers
1 parent 9cad2d7 commit 3a35b47

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

testing/test_junitxml.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,34 @@ def next_sibling(self) -> DomNode:
150150
return DomNode(self._node.nextSibling)
151151

152152

153+
class TestJunitHelpers:
154+
"""minimal test to increase coverage for methods that are used in debugging"""
155+
156+
@pytest.fixture
157+
def document(self) -> DomDocument:
158+
doc = minidom.parseString("""
159+
<root>
160+
<item name="a"></item>
161+
<item name="b"></item>
162+
</root>
163+
""")
164+
return DomDocument(doc)
165+
166+
def test_uc_root(self, document: DomDocument) -> None:
167+
assert document.get_unique_child.tag == "root"
168+
169+
def test_node_assert_attr(self, document: DomDocument) -> None:
170+
item = document.get_first_by_tag("item")
171+
172+
item.assert_attr(name="a")
173+
174+
def test_node_repr(self, document: DomDocument) -> None:
175+
item = document.get_first_by_tag("item")
176+
177+
assert repr(item) == item.toxml()
178+
assert item.toxml() == '<item name="a"/>'
179+
180+
153181
parametrize_families = pytest.mark.parametrize("xunit_family", ["xunit1", "xunit2"])
154182

155183

0 commit comments

Comments
 (0)