summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2020-10-16 12:03:11 -0400
committerMike Bayer <mike_mp@zzzcomputing.com>2020-10-16 19:15:58 -0400
commit5162f2bc5fc0ac239f26a76fc9f0c2c2472adf60 (patch)
tree1ca6d556c17a8cfade13210ba13f1663040bfbb7 /test
parent41d3e16773e84692b6625ccb67da204b5362d9c3 (diff)
downloadsqlalchemy-5162f2bc5fc0ac239f26a76fc9f0c2c2472adf60.tar.gz
Add deprecation for base Executable.bind
These attributes will be removed in SQLAlchemy 2.0. Also alters the deprecation message to qualify the type of object correctly. this in turn requires changes in the warnings filter and deprecation tests. Change-Id: I5779d9813e88f42e5db0c7b5e3ffff1d1535c203
Diffstat (limited to 'test')
-rw-r--r--test/engine/test_deprecations.py14
-rw-r--r--test/engine/test_execute.py2
-rw-r--r--test/orm/inheritance/test_concrete.py8
-rw-r--r--test/orm/inheritance/test_poly_linked_list.py2
-rw-r--r--test/orm/inheritance/test_polymorphic_rel.py8
-rw-r--r--test/orm/inheritance/test_relationship.py8
-rw-r--r--test/orm/inheritance/test_single.py8
-rw-r--r--test/orm/test_deprecations.py14
-rw-r--r--test/sql/test_deprecations.py8
9 files changed, 25 insertions, 47 deletions
diff --git a/test/engine/test_deprecations.py b/test/engine/test_deprecations.py
index c2a98726f..322f9a942 100644
--- a/test/engine/test_deprecations.py
+++ b/test/engine/test_deprecations.py
@@ -91,7 +91,7 @@ class ConnectionlessDeprecationTest(fixtures.TestBase):
conn = e.connect()
with testing.expect_deprecated_20(
- r"The Connection.connect\(\) function/method is considered",
+ r"The Connection.connect\(\) method is considered",
r"The .close\(\) method on a so-called 'branched' connection is "
r"deprecated as of 1.4, as are 'branched' connections overall, "
r"and will be removed in a future release.",
@@ -108,13 +108,13 @@ class ConnectionlessDeprecationTest(fixtures.TestBase):
stmt = table.insert().values(a=1)
with testing.expect_deprecated_20(
- r"The Engine.execute\(\) function/method is considered legacy",
+ r"The Engine.execute\(\) method is considered legacy",
):
testing.db.execute(stmt)
stmt = select(table)
with testing.expect_deprecated_20(
- r"The Engine.execute\(\) function/method is considered legacy",
+ r"The Engine.execute\(\) method is considered legacy",
):
eq_(testing.db.execute(stmt).fetchall(), [(1,)])
@@ -125,13 +125,13 @@ class ConnectionlessDeprecationTest(fixtures.TestBase):
stmt = table.insert().values(a=1)
with testing.expect_deprecated_20(
- r"The Executable.execute\(\) function/method is considered legacy",
+ r"The Executable.execute\(\) method is considered legacy",
):
stmt.execute()
stmt = select(table)
with testing.expect_deprecated_20(
- r"The Executable.execute\(\) function/method is considered legacy",
+ r"The Executable.execute\(\) method is considered legacy",
):
eq_(stmt.execute().fetchall(), [(1,)])
@@ -581,7 +581,7 @@ class DeprecatedReflectionTest(fixtures.TablesTest):
metadata = self.metadata
table = Table("user", metadata)
with testing.expect_deprecated_20(
- r"The Inspector.reflecttable\(\) function/method is considered "
+ r"The Inspector.reflecttable\(\) method is considered "
):
res = inspector.reflecttable(table, None)
exp = inspector.reflect_table(table, None)
@@ -597,7 +597,7 @@ class ExecutionOptionsTest(fixtures.TestBase):
c2 = conn.execution_options(foo="bar")
with testing.expect_deprecated_20(
- r"The Connection.connect\(\) function/method is considered "
+ r"The Connection.connect\(\) method is considered "
):
c2_branch = c2.connect()
eq_(c2_branch._execution_options, {"foo": "bar"})
diff --git a/test/engine/test_execute.py b/test/engine/test_execute.py
index a1d6d2725..0ad9f6f45 100644
--- a/test/engine/test_execute.py
+++ b/test/engine/test_execute.py
@@ -3292,7 +3292,7 @@ class FutureExecuteTest(fixtures.FutureEngineMixin, fixtures.TablesTest):
def test_no_branching(self, connection):
with testing.expect_deprecated(
- r"The Connection.connect\(\) function/method is considered legacy"
+ r"The Connection.connect\(\) method is considered legacy"
):
assert_raises_message(
NotImplementedError,
diff --git a/test/orm/inheritance/test_concrete.py b/test/orm/inheritance/test_concrete.py
index 9b0a050d7..e2777e9e9 100644
--- a/test/orm/inheritance/test_concrete.py
+++ b/test/orm/inheritance/test_concrete.py
@@ -577,9 +577,7 @@ class ConcreteTest(fixtures.MappedTest):
# test adaption of the column by wrapping the query in a
# subquery
- with testing.expect_deprecated(
- r"The Query.from_self\(\) function/method"
- ):
+ with testing.expect_deprecated(r"The Query.from_self\(\) method"):
eq_(
len(
session.connection()
@@ -593,9 +591,7 @@ class ConcreteTest(fixtures.MappedTest):
),
2,
)
- with testing.expect_deprecated(
- r"The Query.from_self\(\) function/method"
- ):
+ with testing.expect_deprecated(r"The Query.from_self\(\) method"):
eq_(
set(
[
diff --git a/test/orm/inheritance/test_poly_linked_list.py b/test/orm/inheritance/test_poly_linked_list.py
index 266fb4b10..83c3e75a0 100644
--- a/test/orm/inheritance/test_poly_linked_list.py
+++ b/test/orm/inheritance/test_poly_linked_list.py
@@ -62,7 +62,7 @@ class PolymorphicCircularTest(fixtures.MappedTest):
# }, None, 'pjoin')
with testing.expect_deprecated_20(
- r"The Join.alias\(\) function/method is considered legacy"
+ r"The Join.alias\(\) method is considered legacy"
):
join = table1.outerjoin(table2).outerjoin(table3).alias("pjoin")
# join = None
diff --git a/test/orm/inheritance/test_polymorphic_rel.py b/test/orm/inheritance/test_polymorphic_rel.py
index dd3ca4821..51277943f 100644
--- a/test/orm/inheritance/test_polymorphic_rel.py
+++ b/test/orm/inheritance/test_polymorphic_rel.py
@@ -1553,9 +1553,7 @@ class _PolymorphicTestBase(object):
palias = aliased(Person)
expected = [(m1, e1), (m1, e2), (m1, b1)]
- with testing.expect_deprecated(
- r"The Query.from_self\(\) function/method"
- ):
+ with testing.expect_deprecated(r"The Query.from_self\(\) method"):
eq_(
sess.query(Person, palias)
.filter(Person.company_id == palias.company_id)
@@ -1575,9 +1573,7 @@ class _PolymorphicTestBase(object):
expected = [(m1, e1), (m1, e2), (m1, b1)]
- with testing.expect_deprecated(
- r"The Query.from_self\(\) function/method"
- ):
+ with testing.expect_deprecated(r"The Query.from_self\(\) method"):
eq_(
sess.query(palias, palias2)
.filter(palias.company_id == palias2.company_id)
diff --git a/test/orm/inheritance/test_relationship.py b/test/orm/inheritance/test_relationship.py
index 03fd05bd5..6879e1465 100644
--- a/test/orm/inheritance/test_relationship.py
+++ b/test/orm/inheritance/test_relationship.py
@@ -1736,9 +1736,7 @@ class SubClassToSubClassMultiTest(AssertsCompiledSQL, fixtures.MappedTest):
# this query is coming out instead which is equivalent, but not
# totally sure where this happens
- with testing.expect_deprecated(
- r"The Query.from_self\(\) function/method"
- ):
+ with testing.expect_deprecated(r"The Query.from_self\(\) method"):
self.assert_compile(
s.query(Sub2).from_self().join(Sub2.ep1).join(Sub2.ep2),
"SELECT anon_1.sub2_id AS anon_1_sub2_id, "
@@ -1789,9 +1787,7 @@ class SubClassToSubClassMultiTest(AssertsCompiledSQL, fixtures.MappedTest):
# I3abfb45dd6e50f84f29d39434caa0b550ce27864,
# this query is coming out instead which is equivalent, but not
# totally sure where this happens
- with testing.expect_deprecated(
- r"The Query.from_self\(\) function/method"
- ):
+ with testing.expect_deprecated(r"The Query.from_self\(\) method"):
self.assert_compile(
# adding Sub2 to the entities list helps it,
diff --git a/test/orm/inheritance/test_single.py b/test/orm/inheritance/test_single.py
index 65dd9c251..aa17f4300 100644
--- a/test/orm/inheritance/test_single.py
+++ b/test/orm/inheritance/test_single.py
@@ -284,9 +284,7 @@ class SingleInheritanceTest(testing.AssertsCompiledSQL, fixtures.MappedTest):
Engineer = self.classes.Engineer
sess = create_session()
- with testing.expect_deprecated(
- r"The Query.from_self\(\) function/method"
- ):
+ with testing.expect_deprecated(r"The Query.from_self\(\) method"):
self.assert_compile(
sess.query(Engineer).from_self(),
"SELECT anon_1.employees_employee_id AS "
@@ -423,9 +421,7 @@ class SingleInheritanceTest(testing.AssertsCompiledSQL, fixtures.MappedTest):
sess = create_session()
col = func.count(literal_column("*"))
- with testing.expect_deprecated(
- r"The Query.from_self\(\) function/method"
- ):
+ with testing.expect_deprecated(r"The Query.from_self\(\) method"):
self.assert_compile(
sess.query(Engineer.employee_id).from_self(col),
"SELECT count(*) AS count_1 "
diff --git a/test/orm/test_deprecations.py b/test/orm/test_deprecations.py
index 7c87879d7..47e804113 100644
--- a/test/orm/test_deprecations.py
+++ b/test/orm/test_deprecations.py
@@ -76,7 +76,7 @@ join_aliased_dep = (
)
w_polymorphic_dep = (
- r"The Query.with_polymorphic\(\) function/method is "
+ r"The Query.with_polymorphic\(\) method is "
"considered legacy as of the 1.x series"
)
@@ -946,9 +946,7 @@ class SelfRefFromSelfTest(fixtures.MappedTest, AssertsCompiledSQL):
)
def _from_self_deprecated(self):
- return testing.expect_deprecated_20(
- r"The Query.from_self\(\) function/method"
- )
+ return testing.expect_deprecated_20(r"The Query.from_self\(\) method")
class DynamicTest(_DynamicFixture, _fixtures.FixtureTest):
@@ -982,9 +980,7 @@ class FromSelfTest(QueryTest, AssertsCompiledSQL):
__dialect__ = "default"
def _from_self_deprecated(self):
- return testing.expect_deprecated_20(
- r"The Query.from_self\(\) function/method"
- )
+ return testing.expect_deprecated_20(r"The Query.from_self\(\) method")
def test_illegal_operations(self):
@@ -1826,9 +1822,7 @@ class FromSelfTest(QueryTest, AssertsCompiledSQL):
class SubqRelationsFromSelfTest(fixtures.DeclarativeMappedTest):
def _from_self_deprecated(self):
- return testing.expect_deprecated_20(
- r"The Query.from_self\(\) function/method"
- )
+ return testing.expect_deprecated_20(r"The Query.from_self\(\) method")
@classmethod
def setup_classes(cls):
diff --git a/test/sql/test_deprecations.py b/test/sql/test_deprecations.py
index 176c16208..d566a1f6b 100644
--- a/test/sql/test_deprecations.py
+++ b/test/sql/test_deprecations.py
@@ -724,7 +724,7 @@ class SelectableTest(fixtures.TestBase, AssertsCompiledSQL):
j1 = self.table1.join(self.table2)
with testing.expect_deprecated_20(
- r"The Join.alias\(\) function/method is considered legacy"
+ r"The Join.alias\(\) method is considered legacy"
):
self.assert_compile(
j1.alias(),
@@ -737,7 +737,7 @@ class SelectableTest(fixtures.TestBase, AssertsCompiledSQL):
)
with testing.expect_deprecated_20(
- r"The Join.alias\(\) function/method is considered legacy"
+ r"The Join.alias\(\) method is considered legacy"
):
self.assert_compile(
j1.alias(flat=True),
@@ -769,7 +769,7 @@ class SelectableTest(fixtures.TestBase, AssertsCompiledSQL):
# test alias of the join
with testing.expect_deprecated(
- r"The Join.alias\(\) function/method is considered legacy"
+ r"The Join.alias\(\) method is considered legacy"
):
j2 = jjj.alias("foo")
assert (
@@ -1589,7 +1589,7 @@ class CursorResultTest(fixtures.TablesTest):
).first()
with testing.expect_deprecated_20(
- r"The Row.keys\(\) function/method is considered legacy "
+ r"The Row.keys\(\) method is considered legacy "
):
eq_(r.keys(), ["user_id", "user_name"])