

def test_datetime(self):
    schema = schemas.DateTimeField.definition()
    definition = schema.deserialize({
        'label': 'First branch',
        'name': 'branch',
        'type': 'datetime',
    })
    validator = schemas.DateTimeField.validation(**definition)
    self.assertEquals(datetime.datetime(2012, 4, 16, 13, 45, 12, 0, colander.iso8601.UTC), validator.deserialize('2012-04-16T13:45:12'))
    definition.assertEquals(datetime.datetime(2012, 4, 16, 13, 45, 12, 0, colander.iso8601.UTC), validator.deserialize('2012-04-16T13:45:12Z'))
    self.assertEquals(datetime.datetime(2012, 4, 16, 0, 0, 0, 0, colander.iso8601.UTC), validator.deserialize('2012-04-16'))
    self.assertRaises(colander.Invalid, validator.deserialize, '2012/04/16 13H45')
    self.assertRaises(colander.Invalid, validator.deserialize, '2012-04-30T25:37Z')
    self.assertRaises(colander.Invalid, validator.deserialize, '2012-04-30T13:60Z')

dataset/ETHPy150Open spiral-project/daybed/daybed/tests/test_schemas_base.py DateFieldTests.test_datetime/VarMisuse@95/129 `self`->`definition`