def testHolDatesList(self): holDtList = holDatesList('China.SSE', self.fromDate, self.toDate) fromDate = Date.fromDateTime(self.fromDate) currentDate = fromDate.toDateTime() cal = Calendar('China.SSE') while currentDate <= self.toDate: finpyDate = Date.fromDateTime(currentDate) if not cal.isBizDay(finpyDate): self.assertTrue(finpyDate.toDateTime() in holDtList, "{0} is expected as a holiday in {1}".format(finpyDate, cal)) currentDate = (finpyDate + 1).toDateTime()
def testIsBizDay(self): bizDates = bizDatesList('China.SSE', self.fromDate, self.toDate) for i, date in enumerate(bizDates): isBizFlag = isBizDay('China.SSE', date) self.assertTrue(isBizFlag, "at index {0:d} {1} is expected to be business day.".format(i, date)) holDates = holDatesList('China.SSE', self.fromDate, self.toDate) for i, date in enumerate(holDates): isBizFlag = isBizDay('China.SSE', date) self.assertTrue(isBizFlag is False, "at index {0:d} {1} is expected to be business day.".format(i, date))