summaryrefslogtreecommitdiff
path: root/test/dialect/sqlite.py
diff options
context:
space:
mode:
authorMichael Trier <mtrier@gmail.com>2009-05-05 00:36:37 +0000
committerMichael Trier <mtrier@gmail.com>2009-05-05 00:36:37 +0000
commit01cdbd073469240065dc0f5c224eaf90f4e113ac (patch)
tree9e72d94dcc99d517abbbba3b62f858b8dae0ec3b /test/dialect/sqlite.py
parentf8daff6da185188d8ed807a7f250320e291ad523 (diff)
downloadsqlalchemy-01cdbd073469240065dc0f5c224eaf90f4e113ac.tar.gz
Corrected the SQLite SLBoolean type so that it properly treats 1 only as True. Fixes #1402
Diffstat (limited to 'test/dialect/sqlite.py')
-rw-r--r--test/dialect/sqlite.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/dialect/sqlite.py b/test/dialect/sqlite.py
index 03e7ecdf3..d01be3521 100644
--- a/test/dialect/sqlite.py
+++ b/test/dialect/sqlite.py
@@ -11,6 +11,28 @@ from testlib import *
class TestTypes(TestBase, AssertsExecutionResults):
__only_on__ = 'sqlite'
+ def test_boolean(self):
+ """Test that the boolean only treats 1 as True
+
+ """
+
+ meta = MetaData(testing.db)
+ t = Table('bool_table', meta,
+ Column('id', Integer, primary_key=True),
+ Column('boo', sqlite.SLBoolean))
+
+ try:
+ meta.create_all()
+ testing.db.execute("INSERT INTO bool_table (id, boo) VALUES (1, 'false');")
+ testing.db.execute("INSERT INTO bool_table (id, boo) VALUES (2, 'true');")
+ testing.db.execute("INSERT INTO bool_table (id, boo) VALUES (3, '1');")
+ testing.db.execute("INSERT INTO bool_table (id, boo) VALUES (4, '0');")
+ testing.db.execute("INSERT INTO bool_table (id, boo) VALUES (5, 1);")
+ testing.db.execute("INSERT INTO bool_table (id, boo) VALUES (6, 0);")
+ assert t.select(t.c.boo).order_by(t.c.id).execute().fetchall() == [(3, True,), (5, True,)]
+ finally:
+ meta.drop_all()
+
def test_string_dates_raise(self):
self.assertRaises(TypeError, testing.db.execute, select([1]).where(bindparam("date", type_=Date)), date=str(datetime.date(2007, 10, 30)))