本文整理汇总了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))