summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorMike Bayer <mike_mp@zzzcomputing.com>2017-01-11 10:12:12 -0500
committerMike Bayer <mike_mp@zzzcomputing.com>2017-01-13 10:57:41 -0500
commitfa6dd376bb24845724287d980a98ea50eb1cfab1 (patch)
tree91e536c76f4b76b8997b02f5cd5a41de29dc90ef /test
parentc703b9ce89483b6f44b97d1fbf56f8df8b14305a (diff)
downloadsqlalchemy-fa6dd376bb24845724287d980a98ea50eb1cfab1.tar.gz
Support python3.6
Corrects some warnings and adds tox config. Adds DeprecationWarning to the error category. Large sweep for string literals w/ backslashes as this is common in docstrings Co-authored-by: Andrii Soldatenko Fixes: #3886 Change-Id: Ia7c838dfbbe70b262622ed0803d581edc736e085 Pull-request: https://github.com/zzzeek/sqlalchemy/pull/337
Diffstat (limited to 'test')
-rw-r--r--test/dialect/postgresql/test_types.py2
-rw-r--r--test/dialect/test_sqlite.py6
-rw-r--r--test/engine/test_execute.py6
-rw-r--r--test/engine/test_logging.py20
-rw-r--r--test/engine/test_transaction.py4
-rw-r--r--test/ext/declarative/test_clsregistry.py4
-rw-r--r--test/ext/test_associationproxy.py4
-rw-r--r--test/orm/test_composites.py4
-rw-r--r--test/orm/test_events.py12
-rw-r--r--test/orm/test_instrumentation.py8
-rw-r--r--test/orm/test_joins.py8
-rw-r--r--test/orm/test_query.py6
-rw-r--r--test/orm/test_relationships.py8
-rw-r--r--test/orm/test_session.py6
-rw-r--r--test/orm/test_transaction.py14
-rw-r--r--test/orm/test_unitofworkv2.py20
-rw-r--r--test/sql/test_compiler.py4
-rw-r--r--test/sql/test_metadata.py6
-rw-r--r--test/sql/test_query.py2
-rw-r--r--test/sql/test_resultset.py2
-rw-r--r--test/sql/test_returning.py2
-rw-r--r--test/sql/test_text.py14
-rw-r--r--test/sql/test_update.py4
23 files changed, 84 insertions, 82 deletions
diff --git a/test/dialect/postgresql/test_types.py b/test/dialect/postgresql/test_types.py
index b558d09fb..c4106c68e 100644
--- a/test/dialect/postgresql/test_types.py
+++ b/test/dialect/postgresql/test_types.py
@@ -1709,7 +1709,7 @@ class HStoreTest(AssertsCompiledSQL, fixtures.TestBase):
assert_raises_message(
ValueError,
r'''After u?'\[\.\.\.\], "key1"=>"value1", ', could not parse '''
- '''residual at position 36: u?'crapcrapcrap, "key3"\[\.\.\.\]''',
+ r'''residual at position 36: u?'crapcrapcrap, "key3"\[\.\.\.\]''',
proc,
'"key2"=>"value2", "key1"=>"value1", '
'crapcrapcrap, "key3"=>"value3"'
diff --git a/test/dialect/test_sqlite.py b/test/dialect/test_sqlite.py
index 1ac67bd31..6735ae30d 100644
--- a/test/dialect/test_sqlite.py
+++ b/test/dialect/test_sqlite.py
@@ -248,7 +248,7 @@ class DateTimeTest(fixtures.TestBase, AssertsCompiledSQL):
"%(year)04d%(month)02d%(day)02d"
"%(hour)02d%(minute)02d%(second)02d%(microsecond)06d"
),
- regexp="(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{6})",
+ regexp=r"(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})(\d{6})",
)
bp = sldt.bind_processor(None)
eq_(bp(dt), '20080627120000000125')
@@ -272,7 +272,7 @@ class DateTest(fixtures.TestBase, AssertsCompiledSQL):
eq_(str(dt), '2008-06-27')
sldt = sqlite.DATE(
storage_format="%(month)02d/%(day)02d/%(year)04d",
- regexp="(?P<month>\d+)/(?P<day>\d+)/(?P<year>\d+)",
+ regexp=r"(?P<month>\d+)/(?P<day>\d+)/(?P<year>\d+)",
)
bp = sldt.bind_processor(None)
eq_(bp(dt), '06/27/2008')
@@ -306,7 +306,7 @@ class TimeTest(fixtures.TestBase, AssertsCompiledSQL):
eq_(str(dt), '2008-06-27')
sldt = sqlite.DATE(
storage_format="%(year)04d%(month)02d%(day)02d",
- regexp="(\d{4})(\d{2})(\d{2})",
+ regexp=r"(\d{4})(\d{2})(\d{2})",
)
bp = sldt.bind_processor(None)
eq_(bp(dt), '20080627')
diff --git a/test/engine/test_execute.py b/test/engine/test_execute.py
index 49b29f7f2..c9f78aa5e 100644
--- a/test/engine/test_execute.py
+++ b/test/engine/test_execute.py
@@ -292,7 +292,7 @@ class ExecuteTest(fixtures.TestBase):
assert_raises_message(
tsa.exc.StatementError,
r"\(test.engine.test_execute.SomeException\) "
- "nope \[SQL\: u?'SELECT 1 ",
+ r"nope \[SQL\: u?'SELECT 1 ",
conn.execute,
select([1]).
where(
@@ -1636,7 +1636,7 @@ class HandleErrorTest(fixtures.TestBase):
assert_raises_message(
tsa.exc.StatementError,
r"\(test.engine.test_execute.SomeException\) "
- "nope \[SQL\: u?'SELECT 1 ",
+ r"nope \[SQL\: u?'SELECT 1 ",
conn.execute,
select([1]).where(
column('foo') == literal('bar', MyType()))
@@ -1828,7 +1828,7 @@ class HandleErrorTest(fixtures.TestBase):
assert_raises_message(
tsa.exc.StatementError,
r"\(test.engine.test_execute.SomeException\) "
- "nope \[SQL\: u?'SELECT 1 ",
+ r"nope \[SQL\: u?'SELECT 1 ",
conn.execute,
select([1]).where(
column('foo') == literal('bar', MyType()))
diff --git a/test/engine/test_logging.py b/test/engine/test_logging.py
index 51ebc5250..e9bc23b41 100644
--- a/test/engine/test_logging.py
+++ b/test/engine/test_logging.py
@@ -185,11 +185,11 @@ class LogParamsTest(fixtures.TestBase):
assert_raises_message(
tsa.exc.DBAPIError,
r".*'INSERT INTO nonexistent \(data\) values \(:data\)'\] "
- "\[parameters: "
- "\[{'data': '0'}, {'data': '1'}, {'data': '2'}, "
- "{'data': '3'}, {'data': '4'}, {'data': '5'}, "
- "{'data': '6'}, {'data': '7'} ... displaying 10 of "
- "100 total bound parameter sets ... {'data': '98'}, {'data': '99'}\]",
+ r"\[parameters: "
+ r"\[{'data': '0'}, {'data': '1'}, {'data': '2'}, "
+ r"{'data': '3'}, {'data': '4'}, {'data': '5'}, "
+ r"{'data': '6'}, {'data': '7'} ... displaying 10 of "
+ r"100 total bound parameter sets ... {'data': '98'}, {'data': '99'}\]",
lambda: self.eng.execute(
"INSERT INTO nonexistent (data) values (:data)",
[{"data": str(i)} for i in range(100)]
@@ -200,11 +200,11 @@ class LogParamsTest(fixtures.TestBase):
assert_raises_message(
tsa.exc.DBAPIError,
r".*INSERT INTO nonexistent \(data\) values "
- "\(\?\)'\] \[parameters: \[\('0',\), \('1',\), \('2',\), \('3',\), "
- "\('4',\), \('5',\), \('6',\), \('7',\) "
- "... displaying "
- "10 of 100 total bound parameter sets ... "
- "\('98',\), \('99',\)\]",
+ r"\(\?\)'\] \[parameters: \[\('0',\), \('1',\), \('2',\), \('3',\), "
+ r"\('4',\), \('5',\), \('6',\), \('7',\) "
+ r"... displaying "
+ r"10 of 100 total bound parameter sets ... "
+ r"\('98',\), \('99',\)\]",
lambda: self.eng.execute(
"INSERT INTO nonexistent (data) values (?)",
[(str(i), ) for i in range(100)]
diff --git a/test/engine/test_transaction.py b/test/engine/test_transaction.py
index 82a0c6317..7e95fb4fa 100644
--- a/test/engine/test_transaction.py
+++ b/test/engine/test_transaction.py
@@ -227,7 +227,7 @@ class TransactionTest(fixtures.TestBase):
with expect_warnings(
"An exception has occurred during handling of a previous "
"exception. The previous exception "
- "is:.*..SQL\:.*RELEASE SAVEPOINT"
+ r"is:.*..SQL\:.*RELEASE SAVEPOINT"
):
def go():
with connection.begin_nested() as savepoint:
@@ -235,7 +235,7 @@ class TransactionTest(fixtures.TestBase):
connection, savepoint._savepoint)
assert_raises_message(
exc.DBAPIError,
- ".*SQL\:.*ROLLBACK TO SAVEPOINT",
+ r".*SQL\:.*ROLLBACK TO SAVEPOINT",
go
)
diff --git a/test/ext/declarative/test_clsregistry.py b/test/ext/declarative/test_clsregistry.py
index 535fd00b3..000479f09 100644
--- a/test/ext/declarative/test_clsregistry.py
+++ b/test/ext/declarative/test_clsregistry.py
@@ -155,8 +155,8 @@ class ClsRegistryTest(fixtures.TestBase):
resolver = resolver("Foo")
assert_raises_message(
exc.InvalidRequestError,
- "When initializing mapper some_parent, expression "
- "'Foo' failed to locate a name \('Foo'\).",
+ r"When initializing mapper some_parent, expression "
+ r"'Foo' failed to locate a name \('Foo'\).",
resolver
)
diff --git a/test/ext/test_associationproxy.py b/test/ext/test_associationproxy.py
index 98e40b11e..5e4ebfe63 100644
--- a/test/ext/test_associationproxy.py
+++ b/test/ext/test_associationproxy.py
@@ -1464,7 +1464,7 @@ class ComparatorTest(fixtures.MappedTest, AssertsCompiledSQL):
assert_raises_message(
exc.ArgumentError,
- "Non-empty has\(\) not allowed",
+ r"Non-empty has\(\) not allowed",
User.singular_value.has,
User.singular_value == "singular4"
)
@@ -1476,7 +1476,7 @@ class ComparatorTest(fixtures.MappedTest, AssertsCompiledSQL):
assert_raises_message(
exc.ArgumentError,
- "Non-empty has\(\) not allowed",
+ r"Non-empty has\(\) not allowed",
User.singular_value.has, singular_value="singular4"
)
diff --git a/test/orm/test_composites.py b/test/orm/test_composites.py
index 48027ec2d..799c7f9bd 100644
--- a/test/orm/test_composites.py
+++ b/test/orm/test_composites.py
@@ -764,8 +764,8 @@ class ConfigurationTest(fixtures.MappedTest):
# renders here, so the "%" operator in the string needs to
# apply the tuple also
r"Composite expects Column objects or mapped "
- "attributes/attribute names as "
- "arguments, got: \(Column",
+ r"attributes/attribute names as "
+ r"arguments, got: \(Column",
configure_mappers
)
diff --git a/test/orm/test_events.py b/test/orm/test_events.py
index 594aabdab..28f0f6998 100644
--- a/test/orm/test_events.py
+++ b/test/orm/test_events.py
@@ -388,17 +388,17 @@ class MapperEventsTest(_RemoveListeners, _fixtures.FixtureTest):
mapper(User, users)
assert_raises_message(
sa.exc.SAWarning,
- "before_configured' and 'after_configured' ORM events only "
- "invoke with the mapper\(\) function or Mapper class as "
- "the target.",
+ r"before_configured' and 'after_configured' ORM events only "
+ r"invoke with the mapper\(\) function or Mapper class as "
+ r"the target.",
event.listen, User, 'before_configured', m1
)
assert_raises_message(
sa.exc.SAWarning,
- "before_configured' and 'after_configured' ORM events only "
- "invoke with the mapper\(\) function or Mapper class as "
- "the target.",
+ r"before_configured' and 'after_configured' ORM events only "
+ r"invoke with the mapper\(\) function or Mapper class as "
+ r"the target.",
event.listen, User, 'after_configured', m1
)
diff --git a/test/orm/test_instrumentation.py b/test/orm/test_instrumentation.py
index c3d24ebe7..88308f19c 100644
--- a/test/orm/test_instrumentation.py
+++ b/test/orm/test_instrumentation.py
@@ -467,10 +467,10 @@ class MapperInitTest(fixtures.ORMTest):
assert_raises_message(
sa.exc.SAWarning,
r"__del__\(\) method on class "
- "<class '.*\.A'> will cause "
- "unreachable cycles and memory leaks, as SQLAlchemy "
- "instrumentation often creates reference cycles. "
- "Please remove this method.",
+ r"<class '.*\.A'> will cause "
+ r"unreachable cycles and memory leaks, as SQLAlchemy "
+ r"instrumentation often creates reference cycles. "
+ r"Please remove this method.",
mapper, A, self.fixture()
)
diff --git a/test/orm/test_joins.py b/test/orm/test_joins.py
index 01f8627bc..0fe829ea4 100644
--- a/test/orm/test_joins.py
+++ b/test/orm/test_joins.py
@@ -442,8 +442,8 @@ class JoinTest(QueryTest, AssertsCompiledSQL):
assert_raises_message(
sa_exc.InvalidRequestError,
- "Don't know how to join from x; please use select_from\(\) to "
- "establish the left entity/selectable of this join",
+ r"Don't know how to join from x; please use select_from\(\) to "
+ r"establish the left entity/selectable of this join",
sess.query(literal_column('x'), User).join, Address
)
@@ -455,8 +455,8 @@ class JoinTest(QueryTest, AssertsCompiledSQL):
assert_raises_message(
sa_exc.InvalidRequestError,
- "No entities to join from; please use select_from\(\) to "
- "establish the left entity/selectable of this join",
+ r"No entities to join from; please use select_from\(\) to "
+ r"establish the left entity/selectable of this join",
sess.query().join, Address
)
diff --git a/test/orm/test_query.py b/test/orm/test_query.py
index 57408e10e..7125fa9c1 100644
--- a/test/orm/test_query.py
+++ b/test/orm/test_query.py
@@ -4087,14 +4087,14 @@ class ImmediateTest(_fixtures.FixtureTest):
assert_raises_message(
sa.orm.exc.NoResultFound,
- "No row was found for one\(\)",
+ r"No row was found for one\(\)",
sess.query(User).filter(User.id == 99).one)
eq_(sess.query(User).filter(User.id == 7).one().id, 7)
assert_raises_message(
sa.orm.exc.MultipleResultsFound,
- "Multiple rows were found for one\(\)",
+ r"Multiple rows were found for one\(\)",
sess.query(User).one)
assert_raises(
@@ -4151,7 +4151,7 @@ class ImmediateTest(_fixtures.FixtureTest):
assert_raises_message(
sa.orm.exc.MultipleResultsFound,
- "Multiple rows were found for one_or_none\(\)",
+ r"Multiple rows were found for one_or_none\(\)",
sess.query(User).one_or_none)
eq_(sess.query(User.id, User.name).filter(User.id == 99).one_or_none(), None)
diff --git a/test/orm/test_relationships.py b/test/orm/test_relationships.py
index 93db643a6..552550c5e 100644
--- a/test/orm/test_relationships.py
+++ b/test/orm/test_relationships.py
@@ -725,7 +725,7 @@ class CompositeSelfRefFKTest(fixtures.MappedTest, AssertsCompiledSQL):
assert_raises_message(
exc.SAWarning,
r"relationship .* will copy column .* to column "
- "employee_t.company_id, which conflicts with relationship\(s\)",
+ r"employee_t.company_id, which conflicts with relationship\(s\)",
configure_mappers
)
@@ -1615,9 +1615,9 @@ class ManualBackrefTest(_fixtures.FixtureTest):
assert_raises_message(sa.exc.ArgumentError,
r"reverse_property 'dingaling' on relationship "
- "User.addresses references "
- "relationship Address.dingaling, which does not "
- "reference mapper Mapper\|User\|users",
+ r"User.addresses references "
+ r"relationship Address.dingaling, which does not "
+ r"reference mapper Mapper\|User\|users",
configure_mappers)
diff --git a/test/orm/test_session.py b/test/orm/test_session.py
index 5cc8aec20..4409959dc 100644
--- a/test/orm/test_session.py
+++ b/test/orm/test_session.py
@@ -1746,19 +1746,19 @@ class FlushWarningsTest(fixtures.MappedTest):
Address = self.classes.Address
def evt(mapper, conn, instance):
object_session(instance).add(Address(email='x1'))
- self._test(evt, "Session.add\(\)")
+ self._test(evt, r"Session.add\(\)")
def test_plain_merge(self):
Address = self.classes.Address
def evt(mapper, conn, instance):
object_session(instance).merge(Address(email='x1'))
- self._test(evt, "Session.merge\(\)")
+ self._test(evt, r"Session.merge\(\)")
def test_plain_delete(self):
Address = self.classes.Address
def evt(mapper, conn, instance):
object_session(instance).delete(Address(email='x1'))
- self._test(evt, "Session.delete\(\)")
+ self._test(evt, r"Session.delete\(\)")
def _test(self, fn, method):
User = self.classes.User
diff --git a/test/orm/test_transaction.py b/test/orm/test_transaction.py
index 85125e2b7..477861f7a 100644
--- a/test/orm/test_transaction.py
+++ b/test/orm/test_transaction.py
@@ -490,9 +490,9 @@ class SessionTransactionTest(FixtureTest):
trans2.rollback()
assert_raises_message(
sa_exc.InvalidRequestError,
- "This Session's transaction has been rolled back by a nested "
- "rollback\(\) call. To begin a new transaction, issue "
- "Session.rollback\(\) first.",
+ r"This Session's transaction has been rolled back by a nested "
+ r"rollback\(\) call. To begin a new transaction, issue "
+ r"Session.rollback\(\) first.",
trans.commit
)
@@ -506,10 +506,10 @@ class SessionTransactionTest(FixtureTest):
trans2.rollback(_capture_exception=True)
assert_raises_message(
sa_exc.InvalidRequestError,
- "This Session's transaction has been rolled back due to a "
- "previous exception during flush. To begin a new transaction "
- "with this Session, first issue Session.rollback\(\). "
- "Original exception was: test",
+ r"This Session's transaction has been rolled back due to a "
+ r"previous exception during flush. To begin a new transaction "
+ r"with this Session, first issue Session.rollback\(\). "
+ r"Original exception was: test",
trans.commit
)
diff --git a/test/orm/test_unitofworkv2.py b/test/orm/test_unitofworkv2.py
index b084071db..352ba2de7 100644
--- a/test/orm/test_unitofworkv2.py
+++ b/test/orm/test_unitofworkv2.py
@@ -1476,8 +1476,8 @@ class BasicStaleChecksTest(fixtures.MappedTest):
p1.data = 3
assert_raises_message(
orm_exc.StaleDataError,
- "UPDATE statement on table 'parent' expected to "
- "update 1 row\(s\); 0 were matched.",
+ r"UPDATE statement on table 'parent' expected to "
+ r"update 1 row\(s\); 0 were matched.",
sess.flush
)
@@ -1506,8 +1506,8 @@ class BasicStaleChecksTest(fixtures.MappedTest):
p1.data = 3
assert_raises_message(
orm_exc.StaleDataError,
- "UPDATE statement on table 'parent' expected to "
- "update 1 row\(s\); 0 were matched.",
+ r"UPDATE statement on table 'parent' expected to "
+ r"update 1 row\(s\); 0 were matched.",
sess.flush
)
@@ -1567,8 +1567,8 @@ class BasicStaleChecksTest(fixtures.MappedTest):
p1.data = literal(1)
assert_raises_message(
orm_exc.StaleDataError,
- "UPDATE statement on table 'parent' expected to "
- "update 1 row\(s\); 0 were matched.",
+ r"UPDATE statement on table 'parent' expected to "
+ r"update 1 row\(s\); 0 were matched.",
sess.flush
)
@@ -1587,8 +1587,8 @@ class BasicStaleChecksTest(fixtures.MappedTest):
assert_raises_message(
exc.SAWarning,
- "DELETE statement on table 'parent' expected to "
- "delete 1 row\(s\); 0 were matched.",
+ r"DELETE statement on table 'parent' expected to "
+ r"delete 1 row\(s\); 0 were matched.",
sess.commit
)
@@ -1607,8 +1607,8 @@ class BasicStaleChecksTest(fixtures.MappedTest):
assert_raises_message(
exc.SAWarning,
- "DELETE statement on table 'parent' expected to "
- "delete 2 row\(s\); 0 were matched.",
+ r"DELETE statement on table 'parent' expected to "
+ r"delete 2 row\(s\); 0 were matched.",
sess.flush
)
diff --git a/test/sql/test_compiler.py b/test/sql/test_compiler.py
index 38ca09c0a..3e7c3d9a3 100644
--- a/test/sql/test_compiler.py
+++ b/test/sql/test_compiler.py
@@ -742,8 +742,8 @@ class SelectTest(fixtures.TestBase, AssertsCompiledSQL):
assert_raises_message(
exc.InvalidRequestError,
r"Select objects don't have a type\. Call as_scalar\(\) "
- "on this Select object to return a 'scalar' "
- "version of this Select\.",
+ r"on this Select object to return a 'scalar' "
+ r"version of this Select\.",
func.coalesce, select([table1.c.myid])
)
diff --git a/test/sql/test_metadata.py b/test/sql/test_metadata.py
index f790c2aa0..ef61a7e87 100644
--- a/test/sql/test_metadata.py
+++ b/test/sql/test_metadata.py
@@ -3050,7 +3050,7 @@ class ConstraintTest(fixtures.TestBase):
return t2
assert_raises_message(
exc.ArgumentError,
- "Element Table\('t2', .* is not a string name or column element",
+ r"Element Table\('t2', .* is not a string name or column element",
Index, "foo", SomeClass()
)
@@ -4213,8 +4213,8 @@ class NamingConventionTest(fixtures.TestBase, AssertsCompiledSQL):
assert_raises_message(
exc.InvalidRequestError,
- "Naming convention including \%\(constraint_name\)s token "
- "requires that constraint is explicitly named.",
+ r"Naming convention including \%\(constraint_name\)s token "
+ r"requires that constraint is explicitly named.",
schema.CreateTable(u1).compile, dialect=default.DefaultDialect()
)
diff --git a/test/sql/test_query.py b/test/sql/test_query.py
index aca933fc9..5a201d904 100644
--- a/test/sql/test_query.py
+++ b/test/sql/test_query.py
@@ -250,7 +250,7 @@ class QueryTest(fixtures.TestBase):
a_eq(prep(r'select \foo'), r'select \foo')
a_eq(prep(r"time='12\:30:00'"), r"time='12\:30:00'")
- a_eq(prep(":this \:that"), "? :that")
+ a_eq(prep(r":this \:that"), "? :that")
a_eq(prep(r"(\:that$other)"), "(:that$other)")
a_eq(prep(r".\:that$ :other."), ".:that$ ?.")
diff --git a/test/sql/test_resultset.py b/test/sql/test_resultset.py
index 64d496a8f..561176a24 100644
--- a/test/sql/test_resultset.py
+++ b/test/sql/test_resultset.py
@@ -1409,7 +1409,7 @@ class PositionalTextTest(fixtures.TablesTest):
with assertions.expect_warnings(
r"Number of columns in textual SQL \(4\) is "
- "smaller than number of columns requested \(2\)"):
+ r"smaller than number of columns requested \(2\)"):
result = testing.db.execute(stmt)
row = result.first()
diff --git a/test/sql/test_returning.py b/test/sql/test_returning.py
index 87994ae9f..96f9eeee4 100644
--- a/test/sql/test_returning.py
+++ b/test/sql/test_returning.py
@@ -129,7 +129,7 @@ class ReturningTest(fixtures.TestBase, AssertsExecutionResults):
)
assert_raises_message(
sa_exc.InvalidRequestError,
- "Can't call inserted_primary_key when returning\(\) is used.",
+ r"Can't call inserted_primary_key when returning\(\) is used.",
getattr, result, "inserted_primary_key"
)
diff --git a/test/sql/test_text.py b/test/sql/test_text.py
index 20cb2a6fb..4a273e1ee 100644
--- a/test/sql/test_text.py
+++ b/test/sql/test_text.py
@@ -253,7 +253,8 @@ class BindParamTest(fixtures.TestBase, AssertsCompiledSQL):
def test_missing_bind_kw(self):
assert_raises_message(
exc.ArgumentError,
- "This text\(\) construct doesn't define a bound parameter named 'bar'",
+ r"This text\(\) construct doesn't define "
+ r"a bound parameter named 'bar'",
text(":foo").bindparams,
foo=5,
bar=7)
@@ -261,7 +262,8 @@ class BindParamTest(fixtures.TestBase, AssertsCompiledSQL):
def test_missing_bind_posn(self):
assert_raises_message(
exc.ArgumentError,
- "This text\(\) construct doesn't define a bound parameter named 'bar'",
+ r"This text\(\) construct doesn't define "
+ r"a bound parameter named 'bar'",
text(":foo").bindparams,
bindparam(
'foo',
@@ -273,8 +275,8 @@ class BindParamTest(fixtures.TestBase, AssertsCompiledSQL):
def test_escaping_colons(self):
# test escaping out text() params with a backslash
self.assert_compile(
- text("select * from foo where clock='05:06:07' "
- "and mork='\:mindy'"),
+ text(r"select * from foo where clock='05:06:07' "
+ r"and mork='\:mindy'"),
"select * from foo where clock='05:06:07' and mork=':mindy'",
checkparams={},
params={},
@@ -284,8 +286,8 @@ class BindParamTest(fixtures.TestBase, AssertsCompiledSQL):
def test_escaping_double_colons(self):
self.assert_compile(
text(
- "SELECT * FROM pg_attribute WHERE "
- "attrelid = :tab\:\:regclass"),
+ r"SELECT * FROM pg_attribute WHERE "
+ r"attrelid = :tab\:\:regclass"),
"SELECT * FROM pg_attribute WHERE "
"attrelid = %(tab)s::regclass",
params={'tab': None},
diff --git a/test/sql/test_update.py b/test/sql/test_update.py
index 6bacdcf72..033f2f680 100644
--- a/test/sql/test_update.py
+++ b/test/sql/test_update.py
@@ -306,8 +306,8 @@ class UpdateTest(_UpdateFromTestBase, fixtures.TablesTest, AssertsCompiledSQL):
table1 = self.tables.mytable
testing.assert_raises_message(
ValueError,
- "When preserve_parameter_order is True, values\(\) "
- "only accepts a list of 2-tuples",
+ r"When preserve_parameter_order is True, values\(\) "
+ r"only accepts a list of 2-tuples",
table1.update(preserve_parameter_order=True).values,
{"description": "foo", "name": "bar"}
)