#NEWLINE# def test_grouped_choices( self ) : #NEWLINE# #INDENT# field_def = CharFieldDefinition . objects . create ( name = 'media' , max_length = 5 , model_def = self . model_def ) #NEWLINE# FieldDefinitionChoice . objects . create ( field_def = field_def , group = 'Audio' , value = 'vinyl' , label = 'Vinyl' ) #NEWLINE# FieldDefinitionChoice . objects . create ( field_def = field_def , group = 'Audio' , value = 'cd' , label = 'CD' ) #NEWLINE# FieldDefinitionChoice . objects . create ( field_def = field_def , group = 'Video' , value = 'vhs' , label = 'VHS Tape' ) #NEWLINE# FieldDefinitionChoice . objects . create ( field_def = field_def , group = 'Video' , value = 'dvd' , label = 'DVD' ) #NEWLINE# FieldDefinitionChoice . objects . create ( field_def = field_def , value = 'unknown' , label = 'Unknown' ) #NEWLINE# Model = self . model_def . model_class ( ) #NEWLINE# choices = Model . _meta . get_field ( 'media' ) . get_choices ( include_blank = False ) #NEWLINE# expected_choices = [ ( 'Audio' , ( ( 'vinyl' , 'Vinyl' ) , ( 'cd' , 'CD' ) ) ) , ( 'Video' , ( ( 'vhs' , 'VHS Tape' ) , ( 'dvd' , 'DVD' ) ) ) , ( 'unknown' , 'Unknown' ) ] #NEWLINE# self . assertEqual ( choices , expected_choices )