#NEWLINE# def test_user_already_exists( self ) : #NEWLINE# #INDENT# data = { #NEWLINE# #INDENT# self . username : 'testclient@example.com' , #NEWLINE# 'password1' : 'test123' , #NEWLINE# 'password2' : 'test123' , #NEWLINE# #UNINDENT# } #NEWLINE# form = UserCreationForm ( data ) #NEWLINE# self . assertFalse ( form . is_valid ( ) ) #NEWLINE# self . assertEqual ( form [ self . username ] . errors , [ ( force_text ( form . error_messages [ 'duplicate_username' ] ) % { #NEWLINE# #INDENT# 'username' : form . username , #NEWLINE# #UNINDENT# } ) ] )