#NEWLINE# def test_drop_nones( self ) : #NEWLINE# #INDENT# orig = { #NEWLINE# #INDENT# 'a' : 1 , #NEWLINE# 'b' : None , #NEWLINE# 'c' : [ 3 , None , 4 , None ] , #NEWLINE# #UNINDENT# } #NEWLINE# ref = { #NEWLINE# #INDENT# 'a' : 1 , #NEWLINE# 'c' : [ 3 , 4 ] , #NEWLINE# #UNINDENT# } #NEWLINE# drop_none = ( lambda p , k , v : ( v is not None ) ) #NEWLINE# remapped = remap ( orig , visit = drop_none ) #NEWLINE# assert ( remapped == ref ) #NEWLINE# orig = ( [ None ] * 100 ) #NEWLINE# remapped = remap ( orig , drop_none ) #NEWLINE# assert ( not remapped )