Skip to content

Commit 025ed94

Browse files
committed
[test/versionConv] Add load xml file
1 parent 8520a2b commit 025ed94

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<odML version="1">
2+
<date>2008-07-07</date>
3+
<section>
4+
<name>sec_one</name>
5+
<type>mainsec</type>
6+
<section>
7+
<name>subsec_one</name>
8+
<type>subsec</type>
9+
</section>
10+
<property>
11+
<name>prop_name</name>
12+
<value>
13+
['one', 'two']
14+
<type>string</type>
15+
</value>
16+
<value>
17+
1
18+
<type>int</type>
19+
</value>
20+
</property>
21+
</section>
22+
<author>author</author>
23+
</odML>

test/test_version_converter.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -510,3 +510,20 @@ def test_convert_odml_file_value(self):
510510
prop = sec.findall("property")[5]
511511
self.assertEqual(len(prop), 1)
512512
self.assertEqual(len(prop.findall("name")), 1)
513+
514+
def test_convert_xml_file(self):
515+
# Test minimal reading from an xml file.
516+
basefile = os.path.join(self.basepath, "version_conversion.xml")
517+
518+
root = self.VC(basefile)._parse_xml().getroot()
519+
self.assertIsNotNone(root.find("section"))
520+
521+
sec = root.find("section")
522+
self.assertIsNotNone(sec.find("name"))
523+
self.assertIsNotNone(sec.find("type"))
524+
self.assertIsNotNone(sec.find("section").find("name"))
525+
self.assertIsNotNone(sec.find("property"))
526+
527+
prop = sec.find("property")
528+
self.assertIsNotNone(prop.find("name"))
529+
self.assertIsNotNone(prop.find("value"))

0 commit comments

Comments
 (0)