def setUp(self): self.calendar = TARGET() self.settlement_days = 2 self.adjusted_today = self.calendar.adjust(today()) Settings().evaluation_date = self.adjusted_today self.settlement_date = self.calendar.advance(today(), self.settlement_days, Days)
def setUp(self): self.calendar = TARGET() self.settlement_days = 2 self.adjusted_today = self.calendar.adjust(today()) Settings().evaluation_date = self.adjusted_today self.settlement_date = self.calendar.advance( today(), self.settlement_days, Days )
def test_converter_1(self): ql_today_1 = today() py_today = datetime.date.today() ql_today_2 = pydate_to_qldate(py_today) self.assertEquals(ql_today_1.day, ql_today_2.day) self.assertEquals(ql_today_1.month, ql_today_2.month) self.assertEquals(ql_today_1.year, ql_today_2.year)
def test_today(self): py_today = datetime.date.today() ql_today = today() self.assertEquals(py_today.day, ql_today.day) self.assertEquals(py_today.month, ql_today.month) self.assertEquals(py_today.year, ql_today.year)
def test_next_code(self): dt = Date(10, Jun, 2014) cd_2 = imm.next_code(dt) # M4 self.assertEqual(cd_2, "M4") cd_3 = imm.next_code('M9', True, today()) # U9 self.assertEqual(cd_3, "U9")
def test_next_date(self): dt = Date(19, Jun, 2014) dt_2 = imm.next_date(dt) # 17 sep 2014 self.assertEqual(dt_2, date(2014, 9, 17)) dt_3 = imm.next_date('M9', True, today()) # 18 sep 2019 self.assertEqual(dt_3, date(2019, 9, 18))
def test_today(self): py_today = datetime.date.today() ql_today = today() self.assertEqual(py_today.day, ql_today.day) self.assertEqual(py_today.month, ql_today.month) self.assertEqual(py_today.year, ql_today.year) py_now = datetime.datetime.now() ql_datetime = local_date_time() self.assertAlmostEqual(Date.from_datetime(py_now), ql_datetime)