def test_mixed_enum(self): States = enum('NEW_JERSEY', NY='NEW_YORK') self.assertEqual(States.NY, 'NEW_YORK') self.assertEqual(States.NEW_JERSEY, 'NEW_JERSEY') self.assertEqual(sorted(States._fields), sorted(['NY', 'NEW_JERSEY']))
def test_args_enum(self): States = enum('NEW_JERSEY', 'NEW_YORK') self.assertEqual(States.NEW_YORK, 'NEW_YORK') self.assertEqual(States.NEW_JERSEY, 'NEW_JERSEY') self.assertEqual(sorted(States._fields), sorted(['NEW_YORK', 'NEW_JERSEY']))
def test_kwargs_enum(self): States = enum(NJ='New Jersey', NY='New York') self.assertEqual(States.NJ, 'New Jersey') self.assertEqual(States.NY, 'New York') self.assertEqual(sorted(States._fields), sorted(['NJ', 'NY']))