From: Mike Bayer Date: Sat, 1 Jan 2022 20:30:15 +0000 (-0500) Subject: adjust error message assertion for TypeError X-Git-Tag: rel_2_0_0b1~567 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=924d38e660981ae2a7d55355603223e0cdf9e4ee;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git adjust error message assertion for TypeError 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 --- diff --git a/test/orm/test_joins.py b/test/orm/test_joins.py index 07420bacca..b83b2a2407 100644 --- a/test/orm/test_joins.py +++ b/test/orm/test_joins.py @@ -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)