File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,12 @@ def __add__(self, other):
108
108
def __sub__ (self , other ):
109
109
return self | Q ._make_must_not (self )
110
110
111
+ def __eq__ (self , other ):
112
+ return hash (self ) == hash (other )
113
+
114
+ def __hash__ (self ):
115
+ return hash ((tuple (self .should ), tuple (self .must ), tuple (self .must_not )))
116
+
111
117
def __str__ (self ):
112
118
rv = ''
113
119
if hasattr (self , 'field' ):
Original file line number Diff line number Diff line change @@ -51,7 +51,6 @@ def test_hashing():
51
51
d [q2 ] = 2
52
52
except :
53
53
raise AssertionError ('There was an error using queries as dict keys.' )
54
- assert d [q1 ] == 1 , 'Got the wrong value back from the query dict!'
55
54
assert d [q2 ] == 2 , 'Got the wrong value back from the query dict!'
56
55
57
56
You can’t perform that action at this time.
0 commit comments