예제 #1
0
 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))
예제 #2
0
 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))
예제 #3
0
 def testDayInMonthIncludesDate(self):
     dt1 = dt.datetime(2015, 12, 1, 0, 0, 0, tzinfo=tz.utc)
     teFunc = te.dayInMonth(2, 0)
     self.assertTrue(teFunc(dt1))
예제 #4
0
 def testDayInMonthSelectsLastTuesdayOfMonth(self):
     dt1 = dt.datetime(2015, 12, 29, 0, 0, 0, tzinfo=tz.utc)
     teFunc = te.dayInMonth(2, -1)
     self.assertTrue(teFunc(dt1))
예제 #5
0
 def testDayInMonthRequiresUtcDate(self):
     dt1 = dt.datetime(2015, 12, 1, 0, 0, 0)
     teFunc = te.dayInMonth(2, 0)
     self.assertRaises(ValueError, teFunc, dt1)
예제 #6
0
 def testDayInMonthIncludesDate(self):
     dt1 = dt.datetime(2015,12,1,0,0,0, tzinfo = tz.utc)
     teFunc = te.dayInMonth(2,0)
     self.assertTrue(teFunc(dt1))
예제 #7
0
 def testDayInMonthSelectsLastTuesdayOfMonth(self):
     dt1 = dt.datetime(2015,12,29,0,0,0, tzinfo = tz.utc)
     teFunc = te.dayInMonth(2,-1)
     self.assertTrue(teFunc(dt1))
예제 #8
0
 def testDayInMonthRequiresUtcDate(self):
     dt1 = dt.datetime(2015,12,1,0,0,0)
     teFunc = te.dayInMonth(2,0)
     self.assertRaises(ValueError, teFunc, dt1)