Пример #1
0
    def test_iter_support(self):
        self.assertTrue(len(list(OrderStatus)) > 0)

        for status in OrderStatus:
            self.assertTrue(hasattr(OrderStatus, status.name))
            self.assertIs(OrderStatus.from_string(status.value), getattr(OrderStatus, status.name))
Пример #2
0
 def test_from_string(self):
     self.assertIs(OrderStatus.from_string('p'), OrderStatus.pending)
     self.assertRaises(ValueError, OrderStatus.from_string, 'invalid')