<s> from test_plus . test import TestCase <EOL> from . . admin import MyUserCreationForm <EOL> class TestMyUserCreationForm ( TestCase ) : <EOL> def setUp ( self ) : <EOL> self . user = self . make_user ( ) <EOL> def test_clean_username_success ( self ) : <EOL> form = MyUserCreationForm ( { <EOL> '<STR_LIT:username>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } ) <EOL> valid = form . is_valid ( ) <EOL> self . assertTrue ( valid ) <EOL> username = form . clean_username ( ) <EOL> self . assertEqual ( '<STR_LIT>' , username ) <EOL> def test_clean_username_false ( self ) : <EOL> form = MyUserCreationForm ( { <EOL> '<STR_LIT:username>' : self . user . username , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> '<STR_LIT>' : '<STR_LIT>' , <EOL> } ) <EOL> valid = form . is_valid ( ) <EOL> self . assertFalse ( valid ) <EOL> self . assertTrue ( len ( form . errors ) == <NUM_LIT:1> ) <EOL> self . assertTrue ( '<STR_LIT:username>' in form . errors ) </s>
