

def test_regex(self):
    schema = schemas.RegexField.definition()
    definition = schema.deserialize({
        'name': 'number',
        'type': 'regex',
        'regex': '\\d+',
    })
    validator = schemas.RegexField.validation(**definition)
    self.assertEquals(1, int(validator.deserialize('1')))
    self.assertRaises(colander.Invalid, validator.deserialize, 'a')

dataset/ETHPy150Open spiral-project/daybed/daybed/tests/test_schemas_base.py BaseFieldsTests.test_regex/original