예제 #1
0
 def testSerialize(self):
     date = datetime.date(2013, 2, 3)
     assert parameter[datetime.date]._p.to_str(date) == "2013-02-03"
     assert YearParameter()._p.to_str(date) == "2013"
     assert MonthParameter()._p.to_str(date) == "2013-02"
     dt = datetime.datetime(2013, 2, 3, 4, 5)
     assert parameters.DateHourParameter()._p.to_str(dt) == "2013-02-03T04"
예제 #2
0
class MonthTask(TTask):
    month = MonthParameter()
예제 #3
0
 def test_serialize(self):
     m = MonthParameter()._p.to_str(datetime.date(2015, 4, 3))
     assert m == "2015-04"
예제 #4
0
 def test_parse(self):
     m = MonthParameter()._p.parse_from_str("2015-04")
     assert m == datetime.date(2015, 4, 1)