File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change
1
+ {
2
+ "Document" : {
3
+ "version" : " v1.13" ,
4
+ "date" : " 2018-07-07" ,
5
+ "author" : " author" ,
6
+ "sections" : [
7
+ {
8
+ "name" : " sec_one" ,
9
+ "type" : " mainsec" ,
10
+ "properties" : [
11
+ {
12
+ "name" : " prop_one" ,
13
+ "values" : [
14
+ {
15
+ "value" : " ['one', 'two']" ,
16
+ "dtype" : " string"
17
+ },
18
+ {
19
+ "value" : " 1" ,
20
+ "dtype" : " int"
21
+ }
22
+ ]
23
+ }
24
+ ],
25
+ "sections" : [
26
+ {
27
+ "name" : " subsec_one" ,
28
+ "sections" : [],
29
+ "type" : " subsec"
30
+ }
31
+ ]
32
+ }
33
+ ]
34
+ },
35
+ "odml-version" : " 1"
36
+ }
Original file line number Diff line number Diff line change @@ -544,3 +544,20 @@ def test_convert_yaml_file(self):
544
544
prop = sec .find ("property" )
545
545
self .assertIsNotNone (prop .find ("name" ))
546
546
self .assertIsNotNone (prop .find ("value" ))
547
+
548
+ def test_convert_json_file (self ):
549
+ # Test minimal reading from a json file.
550
+ basefile = os .path .join (self .basepath , "version_conversion.json" )
551
+
552
+ root = self .VC (basefile )._parse_json ().getroot ()
553
+ self .assertIsNotNone (root .find ("section" ))
554
+
555
+ sec = root .find ("section" )
556
+ self .assertIsNotNone (sec .find ("name" ))
557
+ self .assertIsNotNone (sec .find ("type" ))
558
+ self .assertIsNotNone (sec .find ("section" ))
559
+ self .assertIsNotNone (sec .find ("property" ))
560
+
561
+ prop = sec .find ("property" )
562
+ self .assertIsNotNone (prop .find ("name" ))
563
+ self .assertIsNotNone (prop .find ("value" ))
You can’t perform that action at this time.
0 commit comments