@@ -80,7 +80,7 @@ def data_records_path_with_nested_data():
80
80
}]
81
81
82
82
83
- def expected_data_for_test_records_path_with_nested_data ():
83
+ def expected_data_test_path_with_nested_data ():
84
84
return {0 : [{"TextField" : "Some text" ,
85
85
'UserField' : {'Id' : 'ID001' , 'Name' : 'Name001' },
86
86
"CreatedBy" : {"Name" : "User001" },
@@ -98,6 +98,7 @@ def expected_data_for_test_records_path_with_nested_data():
98
98
"CreatedBy" : {"Name" : "User001" },
99
99
'Image' : {'a' : 'b' }}]}
100
100
101
+
101
102
class TestJSONNormalize (object ):
102
103
103
104
def test_simple_records (self ):
@@ -310,13 +311,15 @@ def test_missing_field(self, author_missing_data):
310
311
tm .assert_frame_equal (result , expected )
311
312
312
313
@pytest .mark .parametrize ("max_level, columns" , [
313
- (0 , ['TextField' , 'UserField' , 'CreatedBy' , "Image" ] ),
314
- (1 , ['TextField' , 'UserField.Id' , 'UserField.Name' , 'CreatedBy' , "Image" ]),
314
+ (0 , ['TextField' , 'UserField' , 'CreatedBy' , "Image" ]),
315
+ (1 , ['TextField' , 'UserField.Id' ,
316
+ 'UserField.Name' , 'CreatedBy' , "Image" ]),
315
317
])
316
- def test_records_path_with_nested_data (self , data_records_path_with_nested_data ,
318
+ def test_records_path_with_nested_data (self ,
319
+ data_records_path_with_nested_data ,
317
320
max_level , columns ):
318
321
test_input = data_records_path_with_nested_data
319
- expected_data = expected_data_for_test_records_path_with_nested_data ()[max_level ]
322
+ expected_data = expected_data_test_path_with_nested_data ()[max_level ]
320
323
result = json_normalize (test_input ,
321
324
record_path = ["Lookup" ],
322
325
meta = [["CreatedBy" ], ["Image" ]],
@@ -331,7 +334,6 @@ def test_flat_stays_flat(self):
331
334
recs = [dict (flat1 = 1 , flat2 = 2 ),
332
335
dict (flat1 = 3 , flat2 = 4 ),
333
336
]
334
-
335
337
result = nested_to_record (recs )
336
338
expected = recs
337
339
assert result == expected
0 commit comments