Did I find the right examples for you? yes no

All Samples(21)  |  Call(21)  |  Derive(0)  |  Import(0)

src/e/l/eliot-0.3.0/eliot/tests/test_validation.py   eliot(Download)
        the list of supported classes.
        """
        field = Field.forTypes("path", [unicode, int], u"A path!")
        field.validate(123)
        field.validate("hello")
        validating C{None}.
        """
        field = Field.forTypes("None", [None], u"Nothing!")
        field.validate(None)
 
        given value's type is not in the list of supported classes.
        """
        field = Field.forTypes("key", [int], u"An integer key")
        self.assertRaises(ValidationError, field.validate, "lala")
        self.assertRaises(ValidationError, field.validate, None)
            else:
                raise ValidationError("too small")
        field = Field.forTypes("key", [int], u"An integer key", validate)
        field.validate(11)
 
            else:
                raise ValidationError("too small")
        field = Field.forTypes("key", [int], u"An int", validate)
        self.assertRaises(ValidationError, field.validate, 10)
 

src/e/l/eliot-0.3.0/eliot/tests/test_testing.py   eliot(Download)
 
 
MESSAGE1 = MessageType("message1", [Field.forTypes("x", [int], "A number")],
                       "A message for testing.")
MESSAGE2 = MessageType("message2", [], "A message for testing.")
 
 
ACTION1 = ActionType("action1", [Field.forTypes("x", [int], "A number")],
                     [Field.forTypes("result", [int], "A number")], [],
                     "A action for testing.")