Here is a testcase that seems to show DateTimeCol() broken for
mx.DateTime objects. This worked for me in 0.5.2. Could be the mysqldb
underneath SQLObject. Anyone seen this?
Index: test.py
===================================================================
--- test.py (revision 273)
+++ test.py (working copy)
@@ -275,6 +275,19 @@
self.assertEqual(TestSO8.select().count(), 0)
self.assertEqual(TestSO9.select().count(), 0)
+class TestSO10(SQLObject):
+ date = DateTimeCol()
+
+class TestCase90(SQLObjectTest):
+
+ classes = [TestSO10]
+
+ def testDateTimeCol(self):
+ d = DateTime.DateTimeFrom('31 Jul 2004 01:30:43 GMT')
+ tc10a = TestSO10(date=d)
+ self.assertEqual(tc10a.date,d)
+
+
########################################
## Fancy sort
########################################
(shake) tests # python test.py
Testing mysql
..................................................F.........
======================================================================
FAIL: testDateTimeCol (__main__.TestCase90)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test.py", line 288, in testDateTimeCol
self.assertEqual(tc10a.date,d)
File "/usr/lib/python2.3/unittest.py", line 302, in failUnlessEqual
raise self.failureException, \
AssertionError: datetime.datetime(2004, 7, 31, 1, 30, 43) != <DateTime object for '2004-07-31 01:30:43.00' at 40342bf0>
----------------------------------------------------------------------
Ran 60 tests in 7.802s
FAILED (failures=1)
(shake) SQLObject # COLUMNS=120 dpkg --list python*mysql* | grep ii
ii python2.3-mysqldb 1.1.5-2 A Python interface to MySQL
(shake) SQLObject # COLUMNS=120 dpkg --list mysql* | grep ii
ii mysql-client 4.0.21-3 mysql database client binaries
ii mysql-common 4.0.21-3 mysql database common files (e.g. /etc/mysql/my.cnf)
ii mysql-server 4.0.21-3 mysql database server binaries
Ryan Harper
|