Beispiel #1
0
 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']))
Beispiel #2
0
 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']))
Beispiel #3
0
 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']))
Beispiel #4
0
 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']))
Beispiel #5
0
 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']))
Beispiel #6
0
 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']))