Exemplo n.º 1
0
	def test_getDateTimeFromString(self):
		formats = ["ISO8601", "YYYYMMDDHHMMSS"]
		tests = ["0503", "20060503", "2006-05-03", "060503"]
		expected_date = datetime.datetime(year, 5, 3, 12, 15, 0)

		tests = ((["ISO8601"], "%s-05-03 12:15:00" % year_str4, expected_date),
		         (["YYYYMMDDHHMMSS"], "%s0503121500" % year_str4, expected_date))
		for test in tests:
			self.assertEqual(dates.getDateTimeFromString(test[1], test[0]), test[2])
Exemplo n.º 2
0
    def test_getDateTimeFromString(self):
        formats = ["ISO8601", "YYYYMMDDHHMMSS"]
        tests = ["0503", "20060503", "2006-05-03", "060503"]
        expected_date = datetime.datetime(year, 05, 03, 12, 15, 00)

        tests = ((["ISO8601"], "%s-05-03 12:15:00" % year_str4, expected_date),
                 (["YYYYMMDDHHMMSS"], "%s0503121500" % year_str4,
                  expected_date))
        for test in tests:
            self.assertEqual(dates.getDateTimeFromString(test[1], test[0]),
                             test[2])
Exemplo n.º 3
0
	def test_getStringFromDateTime(self):
		test_str = "2006-05-03 12:15:00"
		test_datetime = dates.getDateTimeFromString(test_str)
		dabo.dateTimeFormat = "%Y-%m-%d %H:%M:%S"
		self.assertEqual(dates.getStringFromDateTime(test_datetime), test_str)
Exemplo n.º 4
0
 def test_getStringFromDateTime(self):
     test_str = "2006-05-03 12:15:00"
     test_datetime = dates.getDateTimeFromString(test_str)
     dabo.dateTimeFormat = "%Y-%m-%d %H:%M:%S"
     self.assertEqual(dates.getStringFromDateTime(test_datetime), test_str)