#NEWLINE# def test_create( self ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# 'embedded' : { #NEWLINE# #INDENT# '_cls' : 'DumbEmbedded' , #NEWLINE# 'name' : 'emb' , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# serializer = GenericEmbeddingSerializer ( data = data ) #NEWLINE# assert serializer . is_valid ( ) , serializer . errors #NEWLINE# instance = serializer . save ( ) #NEWLINE# assert ( instance . embedded == DumbEmbedded ( name = 'emb' ) ) #NEWLINE# expected = { #NEWLINE# #INDENT# 'id' : str ( instance . id ) , #NEWLINE# 'embedded' : { #NEWLINE# #INDENT# '_cls' : 'DumbEmbedded' , #NEWLINE# 'name' : 'emb' , #NEWLINE# 'foo' : None , #NEWLINE# #UNINDENT# } , #NEWLINE# #UNINDENT# } #NEWLINE# assert ( dict ( serializer . data [ 'embedded' ] ) == instance [ 'embedded' ] )