#NEWLINE# def test_should_not_use_m2m_field_name_for_update_field_list( self ) : #NEWLINE# #INDENT# another_user = UserModel . objects . create ( name = 'vova' ) #NEWLINE# data = { #NEWLINE# #INDENT# 'title' : 'goodbye' , #NEWLINE# 'users_liked' : [ self . user . pk , another_user . pk ] , #NEWLINE# #UNINDENT# } #NEWLINE# serializer = CommentSerializer ( instance = self . get_comment ( ) , data = data , partial = True ) #NEWLINE# self . assertTrue ( serializer . is_valid ( ) ) #NEWLINE# try : #NEWLINE# #INDENT# serializer . save ( ) #NEWLINE# #UNINDENT# except ValueError : #NEWLINE# #INDENT# self . fail ( 'If m2m field used in partial update then it should not be used in update_fields list' ) #NEWLINE# #UNINDENT# fresh_instance = self . get_comment ( ) #NEWLINE# self . assertEqual ( self . title , 'goodbye' ) #NEWLINE# users_liked = set ( fresh_instance . users_liked . all ( ) . values_list ( 'pk' , flat = True ) ) #NEWLINE# self . assertEqual ( users_liked , set ( [ self . user . pk , another_user . pk ] ) )