'Test validation with datetime'

def testValidationWithDateTime(self):

    validate = IS_UTC_DATE()
    class WEST6(datetime.tzinfo, ):
        def utcoffset(self, dt):
            return datetime.timedelta(hours=(-6))
    class EAST5(datetime.tzinfo, ):
        def utcoffset(self, dt):
            return datetime.timedelta(hours=5)
    assertEqual = self.assertEqual
    dt = datetime.datetime(2011, 11, 19, 2, 0, 0)
    (value, error) = validate(dt)
    assertEqual(error, None)
    assertEqual(value, datetime.date(2011, 11, 19))
    dt = datetime.datetime(2011, 11, 19, 19, 0, 0, tzinfo=WEST6())
    (value, error) = validate(dt)
    assertEqual(error, None)
    assertEqual(value, datetime.date(2011, 11, 20))
    current.session.s3.utc_offset = (-8)
    dt = datetime.datetime(2011, 11, 19, 18, 0, 0)
    (value, error) = validate(dt)
    assertEqual(error, None)
    assertEqual(value, datetime.date(2011, 11, 20))
    dt = datetime.datetime(2011, 11, 19, 2, 0, 0, tzinfo=EAST5())
    (value, error) = validate(dt)
    assertEqual(error, None)
    assertEqual(value, datetime.date(2011, 11, 18))
