def test_less_than_other_types(self): # RichEnumValues are always < values of other types self.assertLess(Vegetable.OKRA, Vegetable.OKRA.canonical_name) self.assertLess(Vegetable.OKRA, 11) self.assertLess(Vegetable.OKRA, {'foo': 'bar'}) # ...even if the other type is also descended from RichEnumValue other_okra = RichEnumValue('okra', 'Okra') self.assertLess(Vegetable.OKRA, other_okra)
def test_not_equal_to_other_types(self): self.assertNotEqual(Vegetable.OKRA, None) # RichEnumValues are always != values of other types self.assertNotEqual(Vegetable.OKRA, Vegetable.OKRA.canonical_name) self.assertNotEqual(Vegetable.OKRA, 11) self.assertNotEqual(Vegetable.OKRA, {'foo': 'bar'}) # ...even if the other type is also descended from RichEnumValue other_okra = RichEnumValue('okra', 'Okra') self.assertNotEqual(Vegetable.OKRA, other_okra)
class AudioFormat(RichEnumValue): A8k_16bit_PCM = RichEnumValue(canonical_name="A8k_16bit_PCM", display_name="A8k_16bit_PCM") A16k_16bit_PCM = RichEnumValue(canonical_name="A16k_16bit_PCM", display_name="A16k_16bit_PCM") A8k_A_law = RichEnumValue(canonical_name="A8k_A_law", display_name="A8k_A_law") A16k_A_law = RichEnumValue(canonical_name="A16k_A_law", display_name="A16k_A_law") A8k_U_law = RichEnumValue(canonical_name="A8k_U_law", display_name="A8k_U_law") A16k_U_law = RichEnumValue(canonical_name="A16k_U_law", display_name="A16k_U_law")
class Encoding(RichEnumValue): pcm = RichEnumValue(canonical_name=1, display_name=1) alaw = RichEnumValue(canonical_name=6, display_name=6)
class Rate(RichEnumValue): Hz8k = RichEnumValue(canonical_name=8000, display_name=8000) Hz16k = RichEnumValue(canonical_name=16000, display_name=16000)
class Bits(RichEnumValue): bit8 = RichEnumValue(canonical_name=8, display_name=8) bit16 = RichEnumValue(canonical_name=16, display_name=16)
class Channel(RichEnumValue): mono = RichEnumValue(canonical_name=1, display_name=1) Stereo = RichEnumValue(canonical_name=2, display_name=2)
class MixedBreakfast(OrderedRichEnum): COFFEE = coffee TEA = RichEnumValue('tea', 'Tea')
class Medley(RichEnum): OKRA = okra PARSNIP = RichEnumValue('carrot', 'Carrot')
class Meat(RichEnum): COW = RichEnumValue("cow", "Cow")