Skip to content

Commit c467ad0

Browse files
committed
[test/versionConv] Add _parse_dict_document test
1 parent 2e3cdd9 commit c467ad0

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/test_version_converter.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,22 @@ def test_convert_odml_file_value(self):
520520
self.assertEqual(len(prop), 1)
521521
self.assertEqual(len(prop.findall("name")), 1)
522522

523+
def test_parse_dict_document(self):
524+
# Test appending tags; not appending empty sections
525+
doc_dict = {'Document': {'author': 'HPL', 'sections': []}}
526+
527+
root = self.VC("")._parse_dict_document(doc_dict).getroot()
528+
self.assertEqual(len(root.getchildren()), 1)
529+
self.assertIsNotNone(root.find("author"))
530+
531+
# Test appending multiple sections
532+
doc_dict = {'Document': {'author': 'HPL', 'sections': [{'name': 'sec_one'},
533+
{'name': 'sec_two'}]}}
534+
535+
root = self.VC("")._parse_dict_document(doc_dict).getroot()
536+
self.assertEqual(len(root.getchildren()), 3)
537+
self.assertEqual(len(root.findall("section")), 2)
538+
523539
def test_parse_dict_sections(self):
524540
# Test appending tags; not appending empty subsections or properties
525541
root = ET.Element("root")

0 commit comments

Comments
 (0)