diff options
Diffstat (limited to 'test/ext')
| -rw-r--r-- | test/ext/test_baked.py | 16 | ||||
| -rw-r--r-- | test/ext/test_horizontal_shard.py | 4 | ||||
| -rw-r--r-- | test/ext/test_serializer.py | 10 |
3 files changed, 16 insertions, 14 deletions
diff --git a/test/ext/test_baked.py b/test/ext/test_baked.py index d36a646dd..77e57aa36 100644 --- a/test/ext/test_baked.py +++ b/test/ext/test_baked.py @@ -1298,14 +1298,14 @@ class LazyLoaderTest(testing.AssertsCompiledSQL, BakedTest): # I would think Mock can do this but apparently # it cannot (wrap / autospec don't work together) - real_compile_context = Query._compile_context + real_compile_state = Query._compile_state - def _my_compile_context(*arg, **kw): + def _my_compile_state(*arg, **kw): if arg[0].column_descriptions[0]["entity"] is Address: canary() - return real_compile_context(*arg, **kw) + return real_compile_state(*arg, **kw) - with mock.patch.object(Query, "_compile_context", _my_compile_context): + with mock.patch.object(Query, "_compile_state", _my_compile_state): u1.addresses sess.expire(u1) @@ -1340,8 +1340,8 @@ class LazyLoaderTest(testing.AssertsCompiledSQL, BakedTest): for cond1, cond2 in itertools.product( *[(False, True) for j in range(2)] ): - bq = base_bq._clone() + bq = base_bq._clone() sess = Session() if cond1: @@ -1587,17 +1587,17 @@ class CustomIntegrationTest(testing.AssertsCompiledSQL, BakedTest): # the scope of ORM /execute() integration so that people # don't have to subclass this anymore. - def _execute_and_instances(self, context): + def _execute_and_instances(self, context, **kw): super_ = super(CachingQuery, self) if hasattr(self, "_cache_key"): return self.get_value( createfunc=lambda: super_._execute_and_instances( - context + context, **kw ) ) else: - return super_._execute_and_instances(context) + return super_._execute_and_instances(context, **kw) def get_value(self, createfunc): if self._cache_key in self.cache: diff --git a/test/ext/test_horizontal_shard.py b/test/ext/test_horizontal_shard.py index 26550cc5e..77b716b0a 100644 --- a/test/ext/test_horizontal_shard.py +++ b/test/ext/test_horizontal_shard.py @@ -117,8 +117,8 @@ class ShardTest(object): for value in binary.right.value: ids.append(shard_lookup[value]) - if query._criterion is not None: - FindContinent().traverse(query._criterion) + if query.whereclause is not None: + FindContinent().traverse(query.whereclause) if len(ids) == 0: return ["north_america", "asia", "europe", "south_america"] else: diff --git a/test/ext/test_serializer.py b/test/ext/test_serializer.py index 4080a0044..e252a7f55 100644 --- a/test/ext/test_serializer.py +++ b/test/ext/test_serializer.py @@ -176,7 +176,9 @@ class SerializeTest(AssertsCompiledSQL, fixtures.MappedTest): eq_( q2.join(User.addresses) .filter(Address.email == "ed@bettyboop.com") - .value(func.count(literal_column("*"))), + .enable_eagerloads(False) + .with_entities(func.count(literal_column("*"))) + .scalar(), 1, ) u1 = Session.query(User).get(8) @@ -204,7 +206,7 @@ class SerializeTest(AssertsCompiledSQL, fixtures.MappedTest): ) q2 = serializer.loads(serializer.dumps(q, -1), users.metadata, Session) eq_(q2.all(), [User(name="fred")]) - eq_(list(q2.values(User.id, User.name)), [(9, "fred")]) + eq_(list(q2.with_entities(User.id, User.name)), [(9, "fred")]) @testing.requires.non_broken_pickle def test_query_three(self): @@ -221,8 +223,8 @@ class SerializeTest(AssertsCompiledSQL, fixtures.MappedTest): eq_(q2.all(), [User(name="fred")]) # try to pull out the aliased entity here... - ua_2 = q2._entities[0].entity_zero.entity - eq_(list(q2.values(ua_2.id, ua_2.name)), [(9, "fred")]) + ua_2 = q2._compile_state()._entities[0].entity_zero.entity + eq_(list(q2.with_entities(ua_2.id, ua_2.name)), [(9, "fred")]) def test_annotated_one(self): j = join(users, addresses)._annotate({"foo": "bar"}) |
