@@ -376,26 +376,31 @@ def test_nonetype_dropping(self):
376
376
377
377
assert result == expected
378
378
379
- def test_nonetype_inner_most_level (self ):
380
- # GH21158: If the inner most json has a key with a null value
379
+ def test_nonetype_multiple_levels (self ):
380
+ # GH21158: If inner level json has a key with a null value
381
381
# make sure it doesnt do a new_d.pop twice and except
382
382
data = {
383
- "subject" : {
384
- "pairs" : {
385
- "A1-A2" : {
386
- "atlases" : {
387
- "avg.corrected" : {
388
- "region" : None ,
389
- "x" : 49.151580810546875 ,
390
- "y" : - 33.148521423339844 ,
391
- "z" : 27.572303771972656 }}}
392
- }
383
+ "id" : None ,
384
+ "location" : {
385
+ "id" : None ,
386
+ "country" : {
387
+ "id" : None ,
388
+ "state" : {
389
+ "id" : None ,
390
+ "town.info" : {
391
+ "region" : None ,
392
+ "x" : 49.151580810546875 ,
393
+ "y" : - 33.148521423339844 ,
394
+ "z" : 27.572303771972656 }}}
393
395
}
394
396
}
395
397
result = nested_to_record (data )
396
398
expected = {
397
- 'subject.pairs.A1-A2.atlases.avg.corrected.region' : None ,
398
- 'subject.pairs.A1-A2.atlases.avg.corrected.x' : 49.151580810546875 ,
399
- 'subject.pairs.A1-A2.atlases.avg.corrected.y' : - 33.148521423339844 ,
400
- 'subject.pairs.A1-A2.atlases.avg.corrected.z' : 27.572303771972656 }
399
+ 'location.id' : None ,
400
+ 'location.country.id' : None ,
401
+ 'location.country.state.id' : None ,
402
+ 'location.country.state.town.info.region' : None ,
403
+ 'location.country.state.town.info.x' : 49.151580810546875 ,
404
+ 'location.country.state.town.info.y' : - 33.148521423339844 ,
405
+ 'location.country.state.town.info.z' : 27.572303771972656 }
401
406
assert result == expected
0 commit comments