summaryrefslogtreecommitdiff
path: root/test/sql/test_defaults.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2012-08-20 13:20:09 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2012-08-20 13:20:09 -0400
commitce1b80ad08f58ea18914a93805754a5e19a85abb (patch)
treef231d1bf01abfcb471620284d02db6cd8c896842 /test/sql/test_defaults.py
parent099c9d39ebfc29c7b4058a0b41205bf8b47612c1 (diff)
downloadsqlalchemy-ce1b80ad08f58ea18914a93805754a5e19a85abb.tar.gz
- [bug] Fixes to the interpretation of the
Column "default" parameter as a callable to not pass ExecutionContext into a keyword argument parameter. [ticket:2520]
Diffstat (limited to 'test/sql/test_defaults.py')
-rw-r--r--test/sql/test_defaults.py30
1 files changed, 19 insertions, 11 deletions
diff --git a/test/sql/test_defaults.py b/test/sql/test_defaults.py
index 7a6c6d009..55aa86633 100644
--- a/test/sql/test_defaults.py
+++ b/test/sql/test_defaults.py
@@ -132,10 +132,13 @@ class DefaultTest(fixtures.TestBase):
def test_bad_arg_signature(self):
ex_msg = \
- "ColumnDefault Python function takes zero or one positional arguments"
+ "ColumnDefault Python function takes zero "\
+ "or one positional arguments"
- def fn1(x, y): pass
- def fn2(x, y, z=3): pass
+ def fn1(x, y):
+ pass
+ def fn2(x, y, z=3):
+ pass
class fn3(object):
def __init__(self, x, y):
pass
@@ -150,28 +153,33 @@ class DefaultTest(fixtures.TestBase):
sa.ColumnDefault, fn)
def test_arg_signature(self):
- def fn1(): pass
- def fn2(): pass
- def fn3(x=1): pass
- def fn4(x=1, y=2, z=3): pass
+ def fn1():
+ pass
+ def fn2():
+ pass
+ def fn3(x=1):
+ eq_(x, 1)
+ def fn4(x=1, y=2, z=3):
+ eq_(x, 1)
fn5 = list
class fn6(object):
def __init__(self, x):
- pass
+ eq_(x, "context")
class fn6(object):
def __init__(self, x, y=3):
- pass
+ eq_(x, "context")
class FN7(object):
def __call__(self, x):
- pass
+ eq_(x, "context")
fn7 = FN7()
class FN8(object):
def __call__(self, x, y=3):
- pass
+ eq_(x, "context")
fn8 = FN8()
for fn in fn1, fn2, fn3, fn4, fn5, fn6, fn7, fn8:
c = sa.ColumnDefault(fn)
+ c.arg("context")
@testing.fails_on('firebird', 'Data type unknown')
def test_standalone(self):