'Ensure that invalid values cannot be assigned to datetime
fields.'

def test_datetime_validation(self):

    class LogEntry(Document, ):
        time = DateTimeField()
    log = LogEntry()
    log.time = datetime.datetime.now()
    log.validate()
    log.time = datetime.date.today()
    log.validate()
    log.time = datetime.datetime.now().isoformat('    ')
    log.validate()
    if dateutil:
        log.time = datetime.datetime.now().isoformat('T')
        log.validate()
    log.time = (-1)
    self.assertRaises(ValidationError, log.validate)
    log.time = 'ABC'
    self.assertRaises(ValidationError, log.validate)
