def __new__(cls, value): dt = dates.parse_date(value) return datetime.date.__new__(cls, year=dt.year, month=dt.month, day=dt.day)
def test_parse_date_none(self): parsed = dates.parse_date(None) self.assertEqual(parsed, None)
def test_parse_date(self): dstr = "2015-04-01" parsed = dates.parse_date(dstr) self.assertEqual(dstr, parsed.isoformat())