'Test dtparse with absolute dates'

def testDtParseAbsolute(self):

    assertTrue = self.assertTrue
    assertRaises = self.assertRaises
    assertEqual = self.assertEqual
    ts = S3TimeSeries
    result = ts.dtparse('5/2001')
    assertTrue(isinstance(result, datetime.datetime))
    assertEqual(result, tp_datetime(2001, 5, 1, 0, 0, 0))
    result = ts.dtparse('2007-03')
    assertTrue(isinstance(result, datetime.datetime))
    assertEqual(result, tp_datetime(2007, 3, 1, 0, 0, 0))
    result = ts.dtparse('1996')
    assertTrue(isinstance(result, datetime.datetime))
    assertEqual(result, tp_datetime(1996, 1, 1, 0, 0, 0))
    result = ts.dtparse('2008-02-12')
    assertTrue(isinstance(result, datetime.datetime))
    assertEqual(result, tp_datetime(2008, 2, 12, 0, 0, 0))
    result = ts.dtparse('2008-02-31')
    assertTrue(isinstance(result, datetime.datetime))
    assertEqual(result, tp_datetime(2008, 3, 2, 0, 0, 0))
    now = datetime.datetime.utcnow()
    result = ts.dtparse('')
    assertTrue(isinstance(result, datetime.datetime))
    assertEqual(result.year, now.year)
    assertEqual(result.month, now.month)
    assertEqual(result.day, now.day)
    assertEqual(result.hour, now.hour)
    assertEqual(result.minute, now.minute)
    now = datetime.datetime.utcnow()
    result = ts.dtparse(None)
    assertTrue(isinstance(result, datetime.datetime))
    assertEqual(result.year, now.year)
    assertEqual(result.month, now.month)
    assertEqual(result.day, now.day)
    assertEqual(result.hour, now.hour)
    assertEqual(result.minute, now.minute)
    assertRaises(ValueError, ts.dtparse, '1985-13')
    assertRaises(ValueError, ts.dtparse, '68532')
    assertRaises(ValueError, ts.dtparse, 'invalid')
