diff options
| author | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-05-16 10:32:07 -0400 |
|---|---|---|
| committer | Mike Bayer <mike_mp@zzzcomputing.com> | 2016-05-16 10:32:07 -0400 |
| commit | a51ab916622dd016ce51d6be0969112817cc42ad (patch) | |
| tree | c141be1fd3dc6371eda8e75c17943bf521c914c3 /test/orm/test_evaluator.py | |
| parent | 1873d8107ac8cf4258440914d68f12332220e244 (diff) | |
| download | sqlalchemy-a51ab916622dd016ce51d6be0969112817cc42ad.tar.gz | |
Accommodate "callable" bound param in evaluator
Fixed bug in "evaluate" strategy of :meth:`.Query.update` and
:meth:`.Query.delete` which would fail to accommodate a bound
parameter with a "callable" value, as which occurs when filtering
by a many-to-one equality expression along a relationship.
Change-Id: I47758d3f5d8b9ea1a07e23166780d5f3c32b17f1
Fixes: #3700
Diffstat (limited to 'test/orm/test_evaluator.py')
| -rw-r--r-- | test/orm/test_evaluator.py | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/orm/test_evaluator.py b/test/orm/test_evaluator.py index bafe17b2c..9aae8dd34 100644 --- a/test/orm/test_evaluator.py +++ b/test/orm/test_evaluator.py @@ -1,6 +1,6 @@ """Evaluating SQL expressions on ORM objects""" -from sqlalchemy import String, Integer +from sqlalchemy import String, Integer, bindparam from sqlalchemy.testing.schema import Table from sqlalchemy.testing.schema import Column from sqlalchemy.testing import fixtures @@ -58,6 +58,18 @@ class EvaluateTest(fixtures.MappedTest): (User(id=None), None), ]) + def test_compare_to_callable_bind(self): + User = self.classes.User + + eval_eq( + User.name == bindparam('x', callable_=lambda: 'foo'), + testcases=[ + (User(name='foo'), True), + (User(name='bar'), False), + (User(name=None), None), + ] + ) + def test_compare_to_none(self): User = self.classes.User |
