File tree 1 file changed +27
-0
lines changed
1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -376,6 +376,33 @@ def test_nonetype_dropping(self):
376
376
377
377
assert result == expected
378
378
379
+ def test_nonetype_top_level_bottom_level (self ):
380
+ # GH21158: If inner level json has a key with a null value
381
+ # make sure it doesnt do a new_d.pop twice and except
382
+ data = {
383
+ "id" : None ,
384
+ "location" : {
385
+ "country" : {
386
+ "state" : {
387
+ "id" : None ,
388
+ "town.info" : {
389
+ "id" : None ,
390
+ "region" : None ,
391
+ "x" : 49.151580810546875 ,
392
+ "y" : - 33.148521423339844 ,
393
+ "z" : 27.572303771972656 }}}
394
+ }
395
+ }
396
+ result = nested_to_record (data )
397
+ expected = {
398
+ 'location.country.state.id' : None ,
399
+ 'location.country.state.town.info.id' : None ,
400
+ 'location.country.state.town.info.region' : None ,
401
+ 'location.country.state.town.info.x' : 49.151580810546875 ,
402
+ 'location.country.state.town.info.y' : - 33.148521423339844 ,
403
+ 'location.country.state.town.info.z' : 27.572303771972656 }
404
+ assert result == expected
405
+
379
406
def test_nonetype_multiple_levels (self ):
380
407
# GH21158: If inner level json has a key with a null value
381
408
# make sure it doesnt do a new_d.pop twice and except
You can’t perform that action at this time.
0 commit comments