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))
def test_from_string(self): self.assertIs(OrderStatus.from_string('p'), OrderStatus.pending) self.assertRaises(ValueError, OrderStatus.from_string, 'invalid')