summaryrefslogtreecommitdiff
path: root/test/dialect/test_sqlite.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2009-12-06 22:58:05 +0000
committerMike Bayer <mike_mp@zzzcomputing.com>2009-12-06 22:58:05 +0000
commit7dc4df8a68eafd406e7378eedbb9c26188611a5c (patch)
tree89c6c1d5d7559155e07eeed6545e3362675d685c /test/dialect/test_sqlite.py
parentf9cb6f5834fb1acf4460fd9bb6b72f8c76f8c36c (diff)
downloadsqlalchemy-7dc4df8a68eafd406e7378eedbb9c26188611a5c.tar.gz
- The Boolean type, when used on a backend that doesn't
have native boolean support, will generate a CHECK constraint "col IN (0, 1)" along with the int/smallint- based column type. This can be switched off if desired with create_constraint=False. Note that MySQL has no native boolean *or* CHECK constraint support so this feature isn't available on that platform. [ticket:1589]
Diffstat (limited to 'test/dialect/test_sqlite.py')
-rw-r--r--test/dialect/test_sqlite.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py
index e817d257b..2d5cb1805 100644
--- a/test/dialect/test_sqlite.py
+++ b/test/dialect/test_sqlite.py
@@ -19,7 +19,7 @@ class TestTypes(TestBase, AssertsExecutionResults):
meta = MetaData(testing.db)
t = Table('bool_table', meta,
Column('id', Integer, primary_key=True),
- Column('boo', Boolean))
+ Column('boo', Boolean(create_constraint=False)))
try:
meta.create_all()
@@ -29,12 +29,18 @@ class TestTypes(TestBase, AssertsExecutionResults):
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,)]
+ eq_(
+ 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):
- assert_raises(TypeError, testing.db.execute, select([1]).where(bindparam("date", type_=Date)), date=str(datetime.date(2007, 10, 30)))
+ assert_raises(TypeError,
+ testing.db.execute,
+ select([1]).where(bindparam("date", type_=Date)),
+ date=str(datetime.date(2007, 10, 30)))
def test_time_microseconds(self):
dt = datetime.datetime(2008, 6, 27, 12, 0, 0, 125) # 125 usec