'Test formatter'

def testFormatter(self):

    validate = IS_UTC_DATE()
    assertEqual = self.assertEqual
    dt = None
    dtstr = validate.formatter(dt)
    assertEqual(dtstr, current.messages['NONE'])
    dt = datetime.date(2011, 11, 19)
    dtstr = validate.formatter(dt)
    assertEqual(dtstr, '2011-11-19')
    current.session.s3.utc_offset = (-6)
    dt = datetime.date(2011, 11, 19)
    dtstr = validate.formatter(dt)
    assertEqual(dtstr, '2011-11-19')
    current.session.s3.utc_offset = (+ 6)
    dt = datetime.date(2011, 11, 19)
    dtstr = validate.formatter(dt)
    assertEqual(dtstr, '2011-11-19')
    current.session.s3.utc_offset = (+ 9)
    dt = datetime.date(2011, 11, 19)
    dtstr = validate.formatter(dt)
    assertEqual(dtstr, '2011-11-20')
    validate = IS_UTC_DATE(utc_offset='+1200', format='%d.%m.%Y')
    dt = datetime.datetime(2011, 11, 19, 8, 0, 0)
    dtstr = validate.formatter(dt)
    assertEqual(dtstr, '19.11.2011')
    dt = datetime.datetime(2011, 11, 19, 18, 0, 0)
    dtstr = validate.formatter(dt)
    assertEqual(dtstr, '20.11.2011')
    dt = datetime.date(2011, 11, 19)
    dtstr = validate.formatter(dt)
    assertEqual(dtstr, '20.11.2011')
