File tree Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Expand file tree Collapse file tree 3 files changed +28
-1
lines changed Original file line number Diff line number Diff line change 1+ {"a": 1}
2+ {"b": 2}
3+ {"c": 3}
Original file line number Diff line number Diff line change 1+ 'a'
2+ {"b": 2}
3+ {"c": 3}
Original file line number Diff line number Diff line change @@ -10,6 +10,21 @@ class TestStructure:
1010 def setUp (self ):
1111 self .parser = JsonParser ("json" )
1212
13+ def test_key_value_dict (self ):
14+ sheet_name = 'test'
15+ self .content = self .parser .parse_file (
16+ get_file ("key_value_dict.ndjson" ),
17+ struct = DICT ,
18+ sheet_name = sheet_name )
19+ expected = {
20+ sheet_name : [
21+ [u'a' , 1 ],
22+ [u'b' , 2 ],
23+ [u'c' , 3 ]
24+ ]
25+ }
26+ self ._verify (expected )
27+
1328 def test_dict (self ):
1429 sheet_name = 'test'
1530 self .content = self .parser .parse_file (get_file ("dict.ndjson" ),
@@ -66,12 +81,18 @@ def test_auto_detect_records(self):
6681 self ._verify (expected )
6782
6883 @raises (Exception )
69- def test_unknown (self ):
84+ def test_unknown_as_struct (self ):
7085 sheet_name = 'test'
7186 self .content = self .parser .parse_file (get_file ("records.ndjson" ),
7287 struct = 'unknown' ,
7388 sheet_name = sheet_name )
7489
90+ @raises (Exception )
91+ def test_unknown_format (self ):
92+ sheet_name = 'test'
93+ self .content = self .parser .parse_file (get_file ("unknown.ndjson" ),
94+ sheet_name = sheet_name )
95+
7596 def _verify (self , expected ):
7697 for key in self .content :
7798 self .content [key ] = list (self .content [key ])
You can’t perform that action at this time.
0 commit comments