Skip to content

Commit 2a696c6

Browse files
committed
[test/versionConv] Add load yaml file
1 parent 025ed94 commit 2a696c6

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
Document:
2+
version: v1.13
3+
author: author
4+
date: '2008-07-07'
5+
sections:
6+
- name: sec_one
7+
type: mainsec
8+
sections:
9+
- name: subsec_one
10+
type: subsec
11+
properties:
12+
- name: prop_name
13+
values:
14+
- dtype: !!python/object/apply:odml.dtypes.DType
15+
- string
16+
value: '[''one'', ''two'']'
17+
- dtype: !!python/object/apply:odml.dtypes.DType
18+
- int
19+
value: '1'
20+
odml-version: '1'

test/test_version_converter.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,3 +527,20 @@ def test_convert_xml_file(self):
527527
prop = sec.find("property")
528528
self.assertIsNotNone(prop.find("name"))
529529
self.assertIsNotNone(prop.find("value"))
530+
531+
def test_convert_yaml_file(self):
532+
# Test minimal reading from a yaml file.
533+
basefile = os.path.join(self.basepath, "version_conversion.yaml")
534+
535+
root = self.VC(basefile)._parse_yaml().getroot()
536+
self.assertIsNotNone(root.find("section"))
537+
538+
sec = root.find("section")
539+
self.assertIsNotNone(sec.find("name"))
540+
self.assertIsNotNone(sec.find("type"))
541+
self.assertIsNotNone(sec.find("section"))
542+
self.assertIsNotNone(sec.find("property"))
543+
544+
prop = sec.find("property")
545+
self.assertIsNotNone(prop.find("name"))
546+
self.assertIsNotNone(prop.find("value"))

0 commit comments

Comments
 (0)