From: Mike Bayer Date: Sat, 14 Dec 2019 20:36:38 +0000 (-0500) Subject: Ensure cache keys are hashable in the test X-Git-Tag: rel_1_4_0b1~599 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5411bef285c50b03ea6d8b45193d43c207d4746b;p=thirdparty%2Fsqlalchemy%2Fsqlalchemy.git Ensure cache keys are hashable in the test Change-Id: I962ff15194e2416844086f03dddadb49f48a6c8d --- diff --git a/lib/sqlalchemy/sql/elements.py b/lib/sqlalchemy/sql/elements.py index da75683305..464c2a4d6f 100644 --- a/lib/sqlalchemy/sql/elements.py +++ b/lib/sqlalchemy/sql/elements.py @@ -3263,7 +3263,15 @@ class BinaryExpression(ColumnElement): ("right", self.right._gen_cache_key(anon_map, bindparams)), ("operator", self.operator), ("negate", self.negate), - ("modifiers", self.modifiers), + ( + "modifiers", + tuple( + (key, self.modifiers[key]) + for key in sorted(self.modifiers) + ) + if self.modifiers + else None, + ), ) def __init__( diff --git a/test/sql/test_compare.py b/test/sql/test_compare.py index 5d21960b70..520133272f 100644 --- a/test/sql/test_compare.py +++ b/test/sql/test_compare.py @@ -450,6 +450,7 @@ class CacheKeyFixture(object): a_key = case_a[a]._generate_cache_key() b_key = case_b[b]._generate_cache_key() eq_(a_key.key, b_key.key) + eq_(hash(a_key), hash(b_key)) for a_param, b_param in zip( a_key.bindparams, b_key.bindparams