@@ -162,21 +162,27 @@ def test_empty_array(self):
162162 tm .assert_frame_equal (result , expected )
163163
164164 @pytest .mark .parametrize (
165- "data, record_path, exception_type" ,
165+ "data, record_path, exception_type, expected " ,
166166 [
167- ([{"a" : 0 }, {"a" : 1 }], None , None ),
168- ({"a" : [{"a" : 0 }, {"a" : 1 }]}, "a" , None ),
169- ('{"a": [{"a": 0}, {"a": 1}]}' , None , None ),
170- (None , None , NotImplementedError ),
167+ # List of dicts
168+ ([{"a" : 0 }, {"a" : 1 }], None , None , DataFrame ([0 , 1 ], columns = ["a" ])),
169+
170+ # Dict with array
171+ ({"a" : [{"a" : 0 }, {"a" : 1 }]}, "a" , None , DataFrame ([0 , 1 ], columns = ["a" ])),
172+
173+ # JSON string of array
174+ ('[{"a": 0}, {"a": 1}]' , None , None , DataFrame ([0 , 1 ], columns = ["a" ])),
175+
176+ # None input
177+ (None , None , NotImplementedError , None ),
171178 ],
172179 )
173- def test_accepted_input (self , data , record_path , exception_type ):
180+ def test_accepted_input (self , data , record_path , exception_type , expected ):
174181 if exception_type is not None :
175182 with pytest .raises (exception_type , match = "" ):
176183 json_normalize (data , record_path = record_path )
177184 else :
178185 result = json_normalize (data , record_path = record_path )
179- expected = DataFrame ([0 , 1 ], columns = ["a" ])
180186 tm .assert_frame_equal (result , expected )
181187
182188 def test_simple_normalize_with_separator (self , deep_nested ):
0 commit comments