Update of /usr/cvs/Public/pygresql/module
In directory druid.net:/tmp/cvs-serv23959
Modified Files:
TEST_PyGreSQL_classic.py pg.py
Log Message:
Zero is not NULL. Fix test in _quote_num.
To see the diffs for this commit:
http://www.druid.net/pygresql/viewcvs.cgi/cvs/pygresql/module/TEST_PyGreSQL_classic.py.diff?r1=1.15&r2=1.16
Index: TEST_PyGreSQL_classic.py
===================================================================
RCS file: /usr/cvs/Public/pygresql/module/TEST_PyGreSQL_classic.py,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -p -u -r1.15 -r1.16
--- TEST_PyGreSQL_classic.py 5 Dec 2008 02:05:28 -0000 1.15
+++ TEST_PyGreSQL_classic.py 30 Dec 2008 16:40:00 -0000 1.16
@@ -139,6 +139,10 @@ class utility_test(unittest.TestCase):
def test_quote(self):
_quote = db._quote
+ self.assertEqual(_quote(0, 'int'), "0")
+ self.assertEqual(_quote(0, 'num'), "0")
+ self.assertEqual(_quote('0', 'int'), "0")
+ self.assertEqual(_quote('0', 'num'), "0")
self.assertEqual(_quote(1, 'int'), "1")
self.assertEqual(_quote(1, 'text'), "'1'")
self.assertEqual(_quote(1, 'num'), "1")
http://www.druid.net/pygresql/viewcvs.cgi/cvs/pygresql/module/pg.py.diff?r1=1.76&r2=1.77
Index: pg.py
===================================================================
RCS file: /usr/cvs/Public/pygresql/module/pg.py,v
retrieving revision 1.76
retrieving revision 1.77
diff -u -p -u -r1.76 -r1.77
--- pg.py 5 Dec 2008 15:00:19 -0000 1.76
+++ pg.py 30 Dec 2008 16:40:00 -0000 1.77
@@ -5,7 +5,7 @@
# Written by D'Arcy J.M. Cain
# Improved by Christoph Zwerschke
#
-# $Id: pg.py,v 1.76 2008/12/05 15:00:19 cito Exp $
+# $Id: pg.py,v 1.77 2008/12/30 16:40:00 darcy Exp $
#
"""PyGreSQL classic interface.
@@ -184,7 +184,7 @@ class DB(object):
def _quote_num(self, d):
"""Quote numeric value."""
- if not d:
+ if not d and d != 0:
return 'NULL'
return str(d)
_______________________________________________
PyGreSQL mailing list
[email protected]
http://mailman.vex.net/mailman/listinfo/pygresql