From 81bd994c0adf43eb158a533b605c011fb552dd50 Mon Sep 17 00:00:00 2001 From: Mike Bayer Date: Tue, 19 Apr 2016 15:46:37 -0400 Subject: Rename Query._mapper_zero() to Query._entity_zero() To be more descriptive of the use of _mapper_zero(), rename it to _entity_zero(), but also supply a new _mapper_zero() function that more strictly returns a mapper. The existing _entity_zero() function is renamed to _query_entity_zero. _only_mapper_zero() is removed as it isn't used. Divide up the existing calling functions to refer to the appropriate new method. Change-Id: I8780c3235e87b4936c6daf64d9d299b22b6e1260 Fixes: #3608 --- test/orm/test_froms.py | 11 ++++++----- test/orm/test_query.py | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) (limited to 'test') diff --git a/test/orm/test_froms.py b/test/orm/test_froms.py index 4246df1f6..b4260674d 100644 --- a/test/orm/test_froms.py +++ b/test/orm/test_froms.py @@ -1,6 +1,7 @@ from sqlalchemy import testing from sqlalchemy.testing import ( - fixtures, eq_, assert_raises, assert_raises_message, AssertsCompiledSQL) + fixtures, eq_, is_, assert_raises, + assert_raises_message, AssertsCompiledSQL) from sqlalchemy import ( exc as sa_exc, util, Integer, Table, String, ForeignKey, select, func, and_, asc, desc, inspect, literal_column, cast, exists, text) @@ -1737,8 +1738,8 @@ class MixedEntitiesTest(QueryTest, AssertsCompiledSQL): "ON users.id = addresses_1.user_id"), ]: q = s.query(crit) - mzero = q._mapper_zero() - assert mzero.mapped_table is q._entity_zero().selectable + mzero = q._entity_zero() + is_(mzero.mapped_table, q._query_entity_zero().selectable) q = q.join(j) self.assert_compile(q, exp) @@ -1761,8 +1762,8 @@ class MixedEntitiesTest(QueryTest, AssertsCompiledSQL): "ON users_1.id = addresses_1.user_id") ]: q = s.query(crit) - mzero = q._mapper_zero() - assert inspect(mzero).selectable is q._entity_zero().selectable + mzero = q._entity_zero() + is_(inspect(mzero).selectable, q._query_entity_zero().selectable) q = q.join(j) self.assert_compile(q, exp) diff --git a/test/orm/test_query.py b/test/orm/test_query.py index cdc4ac2c2..d79de1d96 100644 --- a/test/orm/test_query.py +++ b/test/orm/test_query.py @@ -805,7 +805,7 @@ class InvalidGenerationsTest(QueryTest, AssertsCompiledSQL): text("select * from table")) assert_raises(sa_exc.InvalidRequestError, q.with_polymorphic, User) - def test_mapper_zero(self): + def test_only_full_mapper_zero(self): User, Address = self.classes.User, self.classes.Address s = create_session() -- cgit v1.2.1