def test_Date_as_date(): dd = Date() assert isinstance(dd.as_date(), datetime.date) assert not isinstance(dd.as_date(), Date)
def test_Date_default(): today = datetime.date.today() dd = Date() dd.to_string() for key in 'year', 'month', 'day': assert getattr(dd, key) == getattr(today, key)
def test_Date_fromordinal(dd): dd2 = Date.fromordinal(dd.toordinal()) assert dd2 == dd
def test_DateTime_date(): dt = DateTime() assert isinstance(dt.date(), Date) assert dt.date() == Date.today()