]> git.ipfire.org Git - thirdparty/sqlalchemy/sqlalchemy.git/commitdiff
adjust error message assertion for TypeError
authorMike Bayer <mike_mp@zzzcomputing.com>
Sat, 1 Jan 2022 20:30:15 +0000 (15:30 -0500)
committerMike Bayer <mike_mp@zzzcomputing.com>
Sat, 1 Jan 2022 20:30:15 +0000 (15:30 -0500)
in eee7a3add99df2865e6d907f2 I added a few TypeError
tests, and some python interpreters produce a message like
"join() got an unexpected...", others seem to produce
"Query.join() got an unexpected..."

the pattern is strange, all Python 3.10's seem to return the
class name.  For Python 3.8 and 3.9, my local intepreters
are doing the Python 3.10 behavior but github actions are doing
the older behavior.  Python 3.7 both here and on github actions
are doing the older behavior.

In any case, adjust the regexps to match both.

Change-Id: I3ab13e2be51ab243f8f6bcecf26fd03070cec17f

test/orm/test_joins.py

index 07420bacca3b645cd56ecd12ef158871d4102896..b83b2a24078079c2c744a62fc4e804f13399261d 100644 (file)
@@ -411,7 +411,7 @@ class JoinTest(QueryTest, AssertsCompiledSQL):
         sess = fixture_session()
         assert_raises_message(
             TypeError,
-            r"Query.join\(\) got an unexpected keyword argument 'foob'",
+            r".*join\(\) got an unexpected keyword argument 'foob'",
             sess.query(User).join,
             "address",
             foob="bar",
@@ -419,7 +419,7 @@ class JoinTest(QueryTest, AssertsCompiledSQL):
         )
         assert_raises_message(
             TypeError,
-            r"Query.outerjoin\(\) got an unexpected keyword argument 'foob'",
+            r".*outerjoin\(\) got an unexpected keyword argument 'foob'",
             sess.query(User).outerjoin,
             "address",
             foob="bar",
@@ -1767,7 +1767,7 @@ class JoinTest(QueryTest, AssertsCompiledSQL):
 
         with expect_raises_message(
             TypeError,
-            r"Query.join\(\) takes from 2 to 3 positional arguments but "
+            r".*join\(\) takes from 2 to 3 positional arguments but "
             "4 were given",
         ):
             sess.query(User).join(User.orders, Order.items, Item.keywords)