Example #1
0
    def test_repr(self):
        date_repr, to_date_repr = t.Date(), t.ToDate()
        assert repr(date_repr) == '<Date %Y-%m-%d>'
        assert repr(to_date_repr) == '<ToDate %Y-%m-%d>'

        date_repr, to_date_repr = t.Date('%y-%m-%d'), t.ToDate('%y-%m-%d')
        assert repr(date_repr) == '<Date %y-%m-%d>'
        assert repr(to_date_repr) == '<ToDate %y-%m-%d>'
Example #2
0
 def test_to_date(self):
     res = t.ToDate().check("2019-07-25")
     assert res == date(year=2019, month=7, day=25)
     res = t.ToDate().check(datetime.now())
     assert res == date.today()