summaryrefslogtreecommitdiff
path: root/test/engine/test_processors.py
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-08-19 12:08:26 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-08-20 10:14:21 -0400
commita1939719a652774a437f69f8d4788b3f08650089 (patch)
tree309b7423fc4fa919af7af2bb9da81be824ccda87 /test/engine/test_processors.py
parent0901190bb440580f0664fe3f6310173762b908e0 (diff)
downloadsqlalchemy-a1939719a652774a437f69f8d4788b3f08650089.tar.gz
normalize execute style for events, 2.0
The _execute_20 and exec_driver_sql methods should wrap up the parameters so that they represent the single list / single dictionary style of invocation into the legacy methods. then the before_ after_ execute event handlers should be receiving the parameter dictionary as a single dictionary. this requires that we break out distill_params to work differently if event handlers are present. additionally, add deprecation warnings for old argument passing styles. Change-Id: I97cb4d06adfcc6b889f10d01cc7775925cffb116
Diffstat (limited to 'test/engine/test_processors.py')
-rw-r--r--test/engine/test_processors.py34
1 files changed, 21 insertions, 13 deletions
diff --git a/test/engine/test_processors.py b/test/engine/test_processors.py
index 9bfd8d505..3810de06a 100644
--- a/test/engine/test_processors.py
+++ b/test/engine/test_processors.py
@@ -1,6 +1,7 @@
from sqlalchemy.testing import assert_raises_message
from sqlalchemy.testing import eq_
from sqlalchemy.testing import fixtures
+from sqlalchemy.testing import mock
class _BooleanProcessorTest(fixtures.TestBase):
@@ -107,70 +108,77 @@ class CDateProcessorTest(_DateProcessorTest):
class _DistillArgsTest(fixtures.TestBase):
def test_distill_none(self):
- eq_(self.module._distill_params(None, None), [])
+ eq_(self.module._distill_params(mock.Mock(), None, None), [])
def test_distill_no_multi_no_param(self):
- eq_(self.module._distill_params((), {}), [])
+ eq_(self.module._distill_params(mock.Mock(), (), {}), [])
def test_distill_dict_multi_none_param(self):
eq_(
- self.module._distill_params(None, {"foo": "bar"}), [{"foo": "bar"}]
+ self.module._distill_params(mock.Mock(), None, {"foo": "bar"}),
+ [{"foo": "bar"}],
)
def test_distill_dict_multi_empty_param(self):
- eq_(self.module._distill_params((), {"foo": "bar"}), [{"foo": "bar"}])
+ eq_(
+ self.module._distill_params(mock.Mock(), (), {"foo": "bar"}),
+ [{"foo": "bar"}],
+ )
def test_distill_single_dict(self):
eq_(
- self.module._distill_params(({"foo": "bar"},), {}),
+ self.module._distill_params(mock.Mock(), ({"foo": "bar"},), {}),
[{"foo": "bar"}],
)
def test_distill_single_list_strings(self):
eq_(
- self.module._distill_params((["foo", "bar"],), {}),
+ self.module._distill_params(mock.Mock(), (["foo", "bar"],), {}),
[["foo", "bar"]],
)
def test_distill_single_list_tuples(self):
eq_(
self.module._distill_params(
- ([("foo", "bar"), ("bat", "hoho")],), {}
+ mock.Mock(), ([("foo", "bar"), ("bat", "hoho")],), {}
),
[("foo", "bar"), ("bat", "hoho")],
)
def test_distill_single_list_tuple(self):
eq_(
- self.module._distill_params(([("foo", "bar")],), {}),
+ self.module._distill_params(mock.Mock(), ([("foo", "bar")],), {}),
[("foo", "bar")],
)
def test_distill_multi_list_tuple(self):
eq_(
self.module._distill_params(
- ([("foo", "bar")], [("bar", "bat")]), {}
+ mock.Mock(), ([("foo", "bar")], [("bar", "bat")]), {}
),
([("foo", "bar")], [("bar", "bat")]),
)
def test_distill_multi_strings(self):
- eq_(self.module._distill_params(("foo", "bar"), {}), [("foo", "bar")])
+ eq_(
+ self.module._distill_params(mock.Mock(), ("foo", "bar"), {}),
+ [("foo", "bar")],
+ )
def test_distill_single_list_dicts(self):
eq_(
self.module._distill_params(
- ([{"foo": "bar"}, {"foo": "hoho"}],), {}
+ mock.Mock(), ([{"foo": "bar"}, {"foo": "hoho"}],), {}
),
[{"foo": "bar"}, {"foo": "hoho"}],
)
def test_distill_single_string(self):
- eq_(self.module._distill_params(("arg",), {}), [["arg"]])
+ eq_(self.module._distill_params(mock.Mock(), ("arg",), {}), [["arg"]])
def test_distill_multi_string_tuple(self):
eq_(
- self.module._distill_params((("arg", "arg"),), {}),
+ self.module._distill_params(mock.Mock(), (("arg", "arg"),), {}),
[("arg", "arg")],
)