Skip to content

Commit 065f89b

Browse files
committed
refactor: streamline XML string formatting in xml_util.py test cases
Updated the XML string formatting in the XmlTest class to improve readability by removing unnecessary line breaks and indentation. This change enhances the clarity of the test cases while maintaining their functionality.
1 parent 6255f25 commit 065f89b

1 file changed

Lines changed: 10 additions & 22 deletions

File tree

src/colony/test/libs/xml_util.py

Lines changed: 10 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,25 +45,21 @@ def test_xml_to_dict(self):
4545
dictionary conversion.
4646
"""
4747

48-
result = colony.xml_to_dict(
49-
"""<person>
48+
result = colony.xml_to_dict("""<person>
5049
<name>Hello World</name>
5150
<age>32</age>
52-
</person>"""
53-
)
51+
</person>""")
5452
self.assertEqual(result, dict(person=dict(name="Hello World", age="32")))
5553

56-
result = colony.xml_to_dict(
57-
"""<person>
54+
result = colony.xml_to_dict("""<person>
5855
<name>Hello World</name>
5956
<age>32</age>
6057
<address>
6158
<street>Wood Street</street>
6259
<city>London</city>
6360
<country>United Kingdom</country>
6461
</address>
65-
</person>"""
66-
)
62+
</person>""")
6763
self.assertEqual(
6864
result,
6965
dict(
@@ -77,35 +73,27 @@ def test_xml_to_dict(self):
7773
),
7874
)
7975

80-
result = colony.xml_to_dict(
81-
"""<person>
76+
result = colony.xml_to_dict("""<person>
8277
<name>Hello World</name>
8378
<age>32</age>
8479
<address></address>
85-
</person>"""
86-
)
80+
</person>""")
8781
self.assertEqual(
8882
result, dict(person=dict(name="Hello World", age="32", address=None))
8983
)
9084

91-
result = colony.xml_to_dict(
92-
"""<person>
85+
result = colony.xml_to_dict("""<person>
9386
<name>你好世界</name>
9487
<age>32</age>
95-
</person>"""
96-
)
88+
</person>""")
9789
self.assertEqual(
9890
result, dict(person=dict(name=colony.legacy.u("你好世界"), age="32"))
9991
)
10092

101-
result = colony.xml_to_dict(
102-
xml.dom.minidom.parseString(
103-
"""<person>
93+
result = colony.xml_to_dict(xml.dom.minidom.parseString("""<person>
10494
<name>Hello World</name>
10595
<age>32</age>
106-
</person>"""
107-
)
108-
)
96+
</person>"""))
10997
self.assertEqual(result, dict(person=dict(name="Hello World", age="32")))
11098

11199
def test_dict_to_xml(self):

0 commit comments

Comments
 (0)