def testDateTimeOpFormat(self):
     dtt = TimeDataType({"format":"%d-%m-%Y %I:%M %p"});
     retDate = dtt.get({})
     print "Formatted date is: " + retDate
     self.assertRegexpMatches(retDate,'\d\d?-\d\d?-\d\d\d\d \d\d?:\d\d? [AP]M' ,'Format doesnt match')
     dtt = TimeDataType();
     retDate = dtt.get({})
     print "Un Formatted date is: " + retDate
     self.assertNotRegexpMatches(retDate,'\d\d?-\d\d?-\d\d\d\d \d\d?:\d\d? [AP]M' ,'Format doesnt match')
     pass
 def testDateTimeWithRange(self):
     dtt = TimeDataType({"range":["1988-12-20 12:00 AM","1989-12-20 12:00 AM"]});
     retDate = dtt.get({});
     print "Date is " + retDate
     print "Comp-Old: " + getTime(retDate).__str__() + " - " + getTime("2012-12-20 12:00 AM").__str__()
     self.assertGreater(getTime(retDate),\
                         getTime("1988-12-20 12:00 AM"), \
                         "Returned time is too old");
     print "Comp-New: " + getTime(retDate).__str__() + " - " + time.time().__str__()
     self.assertLess(getTime(retDate), getTime("1989-12-20 12:00 AM"), "Returned time is too new")
     pass
 def testDateTime(self):
     dtt = TimeDataType();
     retDate = dtt.get({});
     print "Date is " + retDate
     print "Comp-Old: " + getTime(retDate).__str__() + " - " + getTime('1990-1-1 12:00 AM').__str__()
     self.assertGreater(getTime(retDate),\
                         getTime('1990-1-1 12:00 AM'), \
                         "Returned time is too old");
     print "Comp-New: " + getTime(retDate).__str__() + " - " + time.time().__str__()
     self.assertLess(getTime(retDate), time.time(), "Returned time is too new")
     pass