Data-Test-Executer Framework speziell zum Test von Datenverarbeitungen mit Datengenerierung, Systemvorbereitungen, Einspielungen, ganzheitlicher diversifizierender Vergleich
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
2.6 KiB

import json
2 years ago
import inspect
import unittest
import datetime
import utils.date_tool
2 years ago
#TEST_FUNCTIONS = ["test_dateformat", "test_parseFormula", "test_parseDate"]
TEST_FUNCTIONS = ["test_parseFormula"]
class MyTestCase(unittest.TestCase):
2 years ago
mymsg = "--------------------------------------------------------------"
def test_dateformat(self):
2 years ago
actfunction = str(inspect.currentframe().f_code.co_name)
cnttest = 0
if actfunction not in TEST_FUNCTIONS:
return
stime = datetime.datetime.now()
print(stime)
tdate = (2022, 2, 10)
sdate = datetime.datetime(tdate[0], tdate[1],tdate[2], 3, 32, 23)
sdate = datetime.datetime(stime)
print(sdate)
2 years ago
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest)
def test_parseFormula(self):
actfunction = str(inspect.currentframe().f_code.co_name)
cnttest = 0
if actfunction not in TEST_FUNCTIONS:
return
res = utils.date_tool.parseFormula("{(21.12.2012 +1Y)}")
print(str(res))
self.assertEqual(res[0], 2013)
self.assertEqual(res[3], 0)
res = utils.date_tool.parseFormula("{(21.12.2012 +1Y -1M)}")
print(str(res))
self.assertEqual(res[0], 2013)
self.assertEqual(res[1], 11)
self.assertEqual(res[3], 0)
res = utils.date_tool.parseFormula("{(21.12.2012 +1 Jahre +20 Tage)}")
print(str(res))
self.assertEqual(res[0], 2014)
self.assertEqual(res[1], 1)
self.assertEqual(res[2], 10)
self.assertEqual(res[3], 0)
res = utils.date_tool.parseFormula("{(21.12.2012_11:12:43 +1Y)}")
print(str(res))
self.assertEqual(res[0], 2013)
self.assertEqual(res[5], 43)
res = utils.date_tool.parseFormula("{(21.12.2012 -60M)}")
print(str(res))
self.assertEqual(res[0], 2007)
self.assertEqual(res[1], 12)
self.assertEqual(res[3], 0)
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest)
def test_parseDate(self):
actfunction = str(inspect.currentframe().f_code.co_name)
cnttest = 0
if actfunction not in TEST_FUNCTIONS:
return
res = utils.date_tool.parseDate("21.12.2012")
print(str(res))
self.assertEqual(res[0], 2012)
self.assertEqual(res[3], 0)
res = utils.date_tool.parseDate("{(21.12.2012 +1Y)}")
print(str(res))
self.assertEqual(res[0], 2012)
self.assertEqual(res[3], 0)
MyTestCase.mymsg += "\n----- "+actfunction+" : "+str(cnttest)
if __name__ == '__main__':
unittest.main()