#NEWLINE# def test_various_transforms( self ) : #NEWLINE# #INDENT# d = TransformDict ( ( lambda s : s . encode ( 'utf-8' ) ) ) #NEWLINE# d [ 'Foo' ] = 5 #NEWLINE# self . assertEqual ( d [ 'Foo' ] , 5 ) #NEWLINE# self . check_underlying_dict ( d , { #NEWLINE# #INDENT# b'Foo' : 5 , #NEWLINE# #UNINDENT# } ) #NEWLINE# with self . assertRaises ( AttributeError ) : #NEWLINE# #INDENT# d [ b'Foo' ] #NEWLINE# #UNINDENT# d = TransformDict ( str . swapcase ) #NEWLINE# d [ 'Foo' ] = 5 #NEWLINE# self . assertEqual ( d [ 'Foo' ] , 5 ) #NEWLINE# self . check_underlying_dict ( d , { #NEWLINE# #INDENT# 'fOO' : 5 , #NEWLINE# #UNINDENT# } ) #NEWLINE# with self . assertRaises ( KeyError ) : #NEWLINE# #INDENT# d [ 'fOO' ]