本文整理匯總了Python中django_enumfield.tests.models.PersonStatus類的典型用法代碼示例。如果您正苦於以下問題:Python PersonStatus類的具體用法?Python PersonStatus怎麽用?Python PersonStatus使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
在下文中一共展示了PersonStatus類的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_enum_field_init
def test_enum_field_init(self):
field = EnumField(PersonStatus)
self.assertEqual(field.default, PersonStatus.UNBORN)
self.assertEqual(len(PersonStatus.choices()), len(field.choices))
field = EnumField(PersonStatus, default=PersonStatus.ALIVE)
self.assertEqual(field.default, PersonStatus.ALIVE)
field = EnumField(PersonStatus, default=None)
self.assertEqual(field.default, None)
示例2: test_equal
def test_equal(self):
self.assertTrue(PersonStatus.ALIVE == PersonStatus.ALIVE)
self.assertFalse(PersonStatus.ALIVE == PersonStatus.DEAD)
self.assertEqual(PersonStatus.get(PersonStatus.ALIVE), PersonStatus.get(PersonStatus.ALIVE))
示例3: test_field
def test_field(self):
self.assertTrue(isinstance(PersonStatus.field(), EnumField))
示例4: test_default
def test_default(self):
self.assertEqual(PersonStatus.default(), PersonStatus.UNBORN)
示例5: test_choices
def test_choices(self):
self.assertEqual(len(PersonStatus.choices()), len(list(PersonStatus.items())))
self.assertTrue(all(key in PersonStatus.__dict__ for key in dict(list(PersonStatus.items()))))
示例6: test_get
def test_get(self):
self.assertTrue(isinstance(PersonStatus.get(PersonStatus.ALIVE), Enum.Value))
self.assertTrue(isinstance(PersonStatus.get(six.text_type('ALIVE')), Enum.Value))
self.assertEqual(PersonStatus.get(PersonStatus.ALIVE), PersonStatus.get(six.text_type('ALIVE')))
示例7: test_name
def test_name(self):
self.assertEqual(PersonStatus.name(PersonStatus.ALIVE), six.text_type('ALIVE'))
示例8: test_label
def test_label(self):
self.assertEqual(PersonStatus.label(PersonStatus.ALIVE), six.text_type('ALIVE'))
示例9: test_name
def test_name(self):
self.assertEqual(PersonStatus.name(PersonStatus.ALIVE), u'ALIVE')
示例10: test_label
def test_label(self):
self.assertEqual(PersonStatus.label(PersonStatus.ALIVE), u'Alive')
示例11: test_get
def test_get(self):
self.assertTrue(isinstance(PersonStatus.get(PersonStatus.ALIVE), Enum.Value))
self.assertTrue(isinstance(PersonStatus.get(u'ALIVE'), Enum.Value))
self.assertEqual(unicode(PersonStatus.get(PersonStatus.ALIVE)), PersonStatus.label(PersonStatus.ALIVE))
示例12: test_labels
def test_labels(self):
self.assertIsInstance(dict(LabelBeer.choices())[0].label, (Promise, str))
self.assertIsInstance(dict(PersonStatus.choices())[0].label, (Promise, str))
示例13: test_get
def test_get(self):
self.assertTrue(isinstance(PersonStatus.get(PersonStatus.ALIVE), Enum.Value))
self.assertTrue(isinstance(PersonStatus.get(u"ALIVE"), Enum.Value))