def testTESequenceSelectsAnyMemberThatAppliesToTheDate(self): # first tuesday and last friday of the month fnt = te.temporalExpressionSequence([ \ te.dayInMonth(2,0) \ ,te.dayInMonth(5,-1) \ ]) dtApplies1 = dt.datetime(2015,12,25,0,0,0,tzinfo=tz.utc) dtApplies2 = dt.datetime(2015,2,3,0,0,0,tzinfo=tz.utc) dtDoesNotApply1 = dt.datetime(2015,2,4,0,0,0,tzinfo=tz.utc) self.assertTrue(fnt(dtApplies1)) self.assertTrue(fnt(dtApplies2)) self.assertFalse(fnt(dtDoesNotApply1))
def testTESequenceSelectsAnyMemberThatAppliesToTheDate(self): # first tuesday and last friday of the month fnt = te.temporalExpressionSequence([ \ te.dayInMonth(2,0) \ ,te.dayInMonth(5,-1) \ ]) dtApplies1 = dt.datetime(2015, 12, 25, 0, 0, 0, tzinfo=tz.utc) dtApplies2 = dt.datetime(2015, 2, 3, 0, 0, 0, tzinfo=tz.utc) dtDoesNotApply1 = dt.datetime(2015, 2, 4, 0, 0, 0, tzinfo=tz.utc) self.assertTrue(fnt(dtApplies1)) self.assertTrue(fnt(dtApplies2)) self.assertFalse(fnt(dtDoesNotApply1))
def testDayInMonthIncludesDate(self): dt1 = dt.datetime(2015, 12, 1, 0, 0, 0, tzinfo=tz.utc) teFunc = te.dayInMonth(2, 0) self.assertTrue(teFunc(dt1))
def testDayInMonthSelectsLastTuesdayOfMonth(self): dt1 = dt.datetime(2015, 12, 29, 0, 0, 0, tzinfo=tz.utc) teFunc = te.dayInMonth(2, -1) self.assertTrue(teFunc(dt1))
def testDayInMonthRequiresUtcDate(self): dt1 = dt.datetime(2015, 12, 1, 0, 0, 0) teFunc = te.dayInMonth(2, 0) self.assertRaises(ValueError, teFunc, dt1)
def testDayInMonthIncludesDate(self): dt1 = dt.datetime(2015,12,1,0,0,0, tzinfo = tz.utc) teFunc = te.dayInMonth(2,0) self.assertTrue(teFunc(dt1))
def testDayInMonthSelectsLastTuesdayOfMonth(self): dt1 = dt.datetime(2015,12,29,0,0,0, tzinfo = tz.utc) teFunc = te.dayInMonth(2,-1) self.assertTrue(teFunc(dt1))
def testDayInMonthRequiresUtcDate(self): dt1 = dt.datetime(2015,12,1,0,0,0) teFunc = te.dayInMonth(2,0) self.assertRaises(ValueError, teFunc, dt1)