From 56e88ed7c3b4bd6890087d6d2ced6514076d56c3 Mon Sep 17 00:00:00 2001 From: Michael Trier Date: Sat, 4 Oct 2008 01:49:14 +0000 Subject: Allowed column types to be callables. Fixes #1165. --- test/sql/testtypes.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) (limited to 'test/sql') diff --git a/test/sql/testtypes.py b/test/sql/testtypes.py index 2ed8f37d7..c8b9d7f39 100644 --- a/test/sql/testtypes.py +++ b/test/sql/testtypes.py @@ -797,5 +797,29 @@ class BooleanTest(TestBase, AssertsExecutionResults): print res2 assert(res2==[(2, False)]) +class CallableTest(TestBase, AssertsExecutionResults): + def setUpAll(self): + global meta + meta = MetaData(testing.db) + + def tearDownAll(self): + meta.drop_all() + + def test_callable_as_arg(self): + from functools import partial + ucode = partial(Unicode, assert_unicode=None) + + thing_table = Table('thing', meta, + Column('name', ucode, primary_key=True) + ) + + def test_callable_as_kwarg(self): + from functools import partial + ucode = partial(Unicode, assert_unicode=None) + + thang_table = Table('thang', meta, + Column('name', type_=ucode, primary_key=True) + ) + if __name__ == "__main__": testenv.main() -- cgit v1.2.1