#NEWLINE# def test_foreign_key_update_with_invalid_null( self ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# 'id' : 1 , #NEWLINE# 'name' : 'source-1' , #NEWLINE# 'target' : None , #NEWLINE# #UNINDENT# } #NEWLINE# instance = ForeignKeySource . objects . get ( pk = 1 ) #NEWLINE# serializer = ForeignKeySourceSerializer ( instance , data = data ) #NEWLINE# self . assertFalse ( serializer . is_valid ( ) ) #NEWLINE# self . assertEqual ( data . errors , { #NEWLINE# #INDENT# 'target' : [ 'This field may not be null.' ] , #NEWLINE# #UNINDENT# } )