

def test_date(self):
    schema = schemas.DateField.definition()
    definition = schema.deserialize({
        'label': 'First commit',
        'name': 'creation',
        'type': 'date',
    })
    validator = schemas.DateField.validation(**definition)
    self.assertEquals(datetime.date(2012, 4, 15), validator.deserialize('2012-04-15'))
    self.assertRaises(colander.Invalid, validator.deserialize, '2012/04/15')
    self.assertRaises(colander.Invalid, validator.deserialize, '2012-13-01')
    self.assertRaises(colander.Invalid, validator.deserialize, '2012-04-31')
    self.assertEquals(validator.deserialize('2012-04-30T13:37Z'), datetime.date(2012, 4, 30))

dataset/ETHPy150Open spiral-project/daybed/daybed/tests/test_schemas_base.py DateFieldTests.test_date/original