On Thu 14 May 2009 10:18:47 AM EDT, Matthew Wilson wrote:
> On Wed 13 May 2009 04:35:59 PM EDT, Oleg Broytmann wrote:
>> On Wed, May 13, 2009 at 08:05:26PM +0000, Matthew Wilson wrote:
>>> > IWBN to have a test also.
>>>
>>> I completely agree; can you point me to where in the code I should write
>>> the test? Also, are there any tests I can use as a guide?
>>
>> Any test script would be ok - I'll convert it to the test suit myself.
>> But of course a test in SQLObject style would be even better.
>> SQLObject uses py.test as its testing environment. You can find a lot of
>> tests in sqlobject/tests/ directory.
Here's another test, added to the bottom of test_converters.py:
$ svn diff test_converters.py
Index: test_converters.py
===================================================================
--- test_converters.py (revision 3881)
+++ test_converters.py (working copy)
@@ -1,4 +1,5 @@
import sys
+from datetime import timedelta
from sqlobject.sqlbuilder import sqlrepr
from sqlobject.sqlbuilder import SQLExpression, SQLObjectField, \
Select, Insert, Update, Delete, Replace, \
@@ -195,3 +196,8 @@
pass
else:
assert sqlrepr(Set([1])) == "(1)"
+
+def test_timedeltas():
+
+ assert sqlrepr(timedelta(seconds=30*60)) == \
+ "INTERVAL '0 days 1800 seconds'"
By the way, how do I write a converter that converts a python object one
way for one database (sqlite) and another way for another database
(postgres)? Are there any examples of this already?
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss