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