def test_coerce_accepts_date(self): t = xso.Date() v = datetime.utcnow().date() self.assertEqual(t.coerce(v), v)
def test_coerce_rejects_time(self): t = xso.Date() with self.assertRaisesRegex(TypeError, "must be a date object"): t.coerce(datetime.utcnow().time())
def test_parse(self): t = xso.Date() self.assertEqual( t.parse("1776-07-04"), date(1776, 7, 4), )
def test_format(self): t = xso.Date() self.assertEqual( t.format(date(1776, 7, 4)), "1776-07-04", )
def test_is_abstract_type(self): self.assertIsInstance(xso.Date(), xso.AbstractType)