def test_choices_num_enum_with_defined_ids_should_return_right_values_and_choices( self): choices_num = ChoicesNumEnum(('A', 'label a', 4), ('B', 'label b', 2), ('C', 'label c')) assert_equal(choices_num.A, 4) assert_equal(choices_num.B, 2) assert_equal(choices_num.C, 3) assert_equal(list(choices_num.choices), [(4, 'label a'), (2, 'label b'), (3, 'label c')]) assert_equal(choices_num.all, (4, 2, 3)) assert_equal(choices_num.get_label(4), 'label a') assert_equal(choices_num.get_label(2), 'label b') assert_equal(choices_num.get_label(3), 'label c')
def test_choices_num_enum_with_defined_ids(self): choices_num = ChoicesNumEnum( ('A', 'a', 4), ('B', 'b', 2), ('C', 'c') ) assert_equal(choices_num.A, 4) assert_equal(choices_num.B, 2) assert_equal(choices_num.C, 3) assert_equal(list(choices_num.choices), [(4, 'a'), (2, 'b'), (3, 'c')]) assert_equal(tuple(choices_num.all), (4, 2, 3)) assert_equal(choices_num.get_label(4), 'a') assert_equal(choices_num.get_label(2), 'b') assert_equal(choices_num.get_label(3), 'c')
def test_choices_num_enum_with_defined_ids_should_return_right_values_and_choices(self): choices_num = ChoicesNumEnum( ('A', 'label a', 4), ('B', 'label b', 2), ('C', 'label c') ) assert_equal(choices_num.A, 4) assert_equal(choices_num.B, 2) assert_equal(choices_num.C, 3) assert_equal(list(choices_num.choices), [(4, 'label a'), (2, 'label b'), (3, 'label c')]) assert_equal(choices_num.all, (4, 2, 3)) assert_equal(choices_num.get_label(4), 'label a') assert_equal(choices_num.get_label(2), 'label b') assert_equal(choices_num.get_label(3), 'label c')
def test_choices_num_enum(self): choices_num = ChoicesNumEnum( ('A', 'a'), ('B', 'b'), ) assert_equal(choices_num.A, 1) assert_equal(choices_num.B, 2) assert_equal(list(choices_num.choices), [(1, 'a'), (2, 'b')]) assert_equal(tuple(choices_num.all), (1, 2)) assert_equal(choices_num.get_label(1), 'a') assert_equal(choices_num.get_label(2), 'b') assert_raises(AttributeError, choices_num.get_label, 3)
def test_choices_num_enum_should_return_right_values_and_choices(self): choices_num = ChoicesNumEnum( ('A', 'label a'), ('B', 'label b'), ) assert_equal(choices_num.A, 1) assert_equal(choices_num.B, 2) assert_equal(list(choices_num.choices), [(1, 'label a'), (2, 'label b')]) assert_equal(tuple(choices_num.all), (1, 2)) assert_equal(choices_num.get_label(1), 'label a') assert_equal(choices_num.get_label(2), 'label b') assert_raises(AttributeError, choices_num.get_label, 3)
def test_choices_num_enum_should_return_right_values_and_choices(self): choices_num = ChoicesNumEnum( ('A', 'label a'), ('B', 'label b'), ) assert_equal(choices_num.A, 1) assert_equal(choices_num.B, 2) assert_equal(list(choices_num.choices), [(1, 'label a'), (2, 'label b')]) assert_equal(tuple(choices_num.all), (1, 2)) assert_equal(choices_num.get_label(1), 'label a') assert_equal(choices_num.get_label(2), 'label b') assert_raises(AttributeError, choices_num.get_label, 3)