Permalink
Browse files

add testBoolean

  • Loading branch information...
1 parent d0e2dc2 commit 2e6671cb3f65220b975e5733bfde447885ef6f19 @anandology anandology committed May 8, 2009
Showing with 14 additions and 1 deletion.
  1. +14 −1 test/db.py
View
15 test/db.py
@@ -8,7 +8,7 @@ class DBTest(webtest.TestCase):
def setUp(self):
self.db = webtest.setup_database(self.dbname, driver=self.driver)
- self.db.query("CREATE TABLE person (name text, email text)")
+ self.db.query("CREATE TABLE person (name text, email text, active boolean)")
def tearDown(self):
# there might be some error with the current connection, delete from a new connection
@@ -94,6 +94,15 @@ def test_result_is_unicode(self):
name = db.select('person')[0].name
self.assertEquals(type(name), unicode)
+ def testBoolean(self):
+ def t(active):
+ name ='name-%s' % active
+ self.db.insert('person', False, name=name, active=active)
+ a = self.db.select('person', where='name=$name', vars=locals())[0].active
+ self.assertEquals(a, active)
+ t(False)
+ t(True)
+
class PostgresTest(DBTest):
dbname = "postgres"
driver = "psycopg2"
@@ -123,6 +132,10 @@ def setUp(self):
# In mysql, transactions are supported only with INNODB engine.
self.db.query("CREATE TABLE person (name text, email text) ENGINE=INNODB")
+ def testBoolean(self):
+ # boolean datatype is not suppoted in MySQL (at least until v5.0)
+ pass
+
del DBTest
def is_test(cls):

0 comments on commit 2e6671c

Please sign in to comment.