<s> from django . test import TestCase <EOL> from projector . utils . helpers import Choices <EOL> class ChoicesTest ( TestCase ) : <EOL> def test ( self ) : <EOL> class Status ( Choices ) : <EOL> FIRST = <NUM_LIT:1> <EOL> SECOND = <NUM_LIT:2> <EOL> THIRD = <NUM_LIT:3> <EOL> choices = Status . as_choices ( ) <EOL> self . assertEqual ( choices , <EOL> [ <EOL> ( <NUM_LIT:1> , u'<STR_LIT>' ) , <EOL> ( <NUM_LIT:2> , u'<STR_LIT>' ) , <EOL> ( <NUM_LIT:3> , u'<STR_LIT>' ) , <EOL> ] <EOL> ) <EOL> def test_with_underscore ( self ) : <EOL> class Status ( Choices ) : <EOL> FIRST = <NUM_LIT:1> <EOL> SECOND = <NUM_LIT:2> <EOL> THIRD_AND_LAST = <NUM_LIT:3> <EOL> choices = Status . as_choices ( ) <EOL> self . assertEqual ( choices , <EOL> [ <EOL> ( <NUM_LIT:1> , u'<STR_LIT>' ) , <EOL> ( <NUM_LIT:2> , u'<STR_LIT>' ) , <EOL> ( <NUM_LIT:3> , u'<STR_LIT>' ) , <EOL> ] <EOL> ) <EOL> def test_with_not_all_uppered ( self ) : <EOL> class Status ( Choices ) : <EOL> FIRST = <NUM_LIT:1> <EOL> SECOND = <NUM_LIT:2> <EOL> third = <NUM_LIT:3> <EOL> choices = Status . as_choices ( ) <EOL> self . assertEqual ( choices , <EOL> [ <EOL> ( <NUM_LIT:1> , u'<STR_LIT>' ) , <EOL> ( <NUM_LIT:2> , u'<STR_LIT>' ) , <EOL> ] <EOL> ) <EOL> def test_with_no_integers ( self ) : <EOL> class Status ( Choices ) : <EOL> FIRST = <NUM_LIT:1> <EOL> SECOND = <NUM_LIT:2> <EOL> THIRD = '<STR_LIT>' <EOL> choices = Status . as_choices ( ) <EOL> self . assertEqual ( choices , <EOL> [ <EOL> ( <NUM_LIT:1> , u'<STR_LIT>' ) , <EOL> ( <NUM_LIT:2> , u'<STR_LIT>' ) , <EOL> ] <EOL> ) <EOL> def test_order ( self ) : <EOL> class Status ( Choices ) : <EOL> SECOND = <NUM_LIT:2> <EOL> NEXT = <NUM_LIT> <EOL> THIRD = <NUM_LIT:3> <EOL> ERROR = - <NUM_LIT:1> <EOL> FIRST = <NUM_LIT:1> <EOL> choices = Status . as_choices ( ) <EOL> ints = [ c [ <NUM_LIT:0> ] for c in choices ] <EOL> self . assertEqual ( ints , [ - <NUM_LIT:1> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT> ] ) </s>
