#NEWLINE# def test_simple_choices( self ) : #NEWLINE# #INDENT# field_def = CharFieldDefinition . objects . create ( name = 'gender' , max_length = 1 , model_def = self . model_def ) #NEWLINE# male_choice = FieldDefinitionChoice ( field_def = field_def , value = 'Male' , label = 'Male' ) #NEWLINE# self . assertRaises ( ValidationError , male_choice . clean ) #NEWLINE# male_choice . value = 'M' #NEWLINE# male_choice . full_clean ( ) #NEWLINE# male_choice . save ( ) #NEWLINE# Model = self . model_def . model_class ( ) #NEWLINE# obj = Model ( gender = 'T' ) #NEWLINE# self . assertRaises ( ValidationError , obj . full_clean ) #NEWLINE# female_choice = FieldDefinitionChoice ( field_def = field_def , value = 'F' , label = 'Female' ) #NEWLINE# female_choice . value = 'F' #NEWLINE# female_choice . full_clean ( ) #NEWLINE# female_choice . save ( ) #NEWLINE# obj = Model ( gender = 'F' ) #NEWLINE# obj . full_clean ( ) #NEWLINE# choices = Model . _meta . get_field ( 'gender' ) . get_choices ( include_blank = False ) #NEWLINE# self . assertEqual ( choices , [ ( 'M' , 'Male' ) , ( 'F' , 'Female' ) ] )