Example #1
0
 def test_parse_str_to_str(self):
     col = DateCol('alpha')
     # default
     self.assertEquals(None, col.default_value)
     # parse_str
     d = datetime.date(2006,5,30)
     self.assertEquals(d, col.parse_str("2006-05-30"))
     self.assertEquals(None, col.parse_str(''))
     # to_str
     self.assertEquals("2006-05-30", col.py_to_db(d))
     self.assertEquals('', col.to_str(None))
Example #2
0
 def test_py_to_db(self):
     col = DateTimeUTCCol('alpha')
     self.assertEquals(None, col.py_to_db(None))
     d = datetime.datetime(2006,5,30,17,02,13,403000)
     self.assertEquals("2006-05-30T17:02:13Z", col.py_to_db(d))
Example #3
0
 def test_py_to_db(self):
     col = DateCol('alpha')
     self.assertEquals(None, col.py_to_db(None))
     d = datetime.date(2006,5,30)
     self.assertEquals("2006-05-30", col.py_to_db(d))
Example #4
0
 def test_to(self):
     col = _XCol('a', False, str, 'x')
     x = object()
     self.assert_(col.py_to_db(x) is x)
     self.assert_(col.db_to_py(x) is x)