Skip to content

Commit bc0f8be

Browse files
committed
Fixup psycopg3 tests that were failing.
1 parent 8c0ae51 commit bc0f8be

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

playhouse/psycopg3_ext.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,7 @@ def concat(self, rhs):
3737
return Expression(self.as_json(True), OP.CONCAT, rhs)
3838

3939
def contains(self, other):
40-
clone = self.as_json(True)
41-
if isinstance(other, (list, dict)):
42-
return Expression(clone, JSONB_CONTAINS, Jsonb(other)) # Same.
43-
return Expression(clone, JSONB_EXISTS, other)
40+
return Expression(self.as_json(True), JSONB_CONTAINS, Jsonb(other))
4441

4542

4643
class JsonLookup(_Psycopg3JsonLookupBase):
@@ -99,11 +96,9 @@ def concat(self, value):
9996
return super(BinaryJSONField, self).concat(value)
10097

10198
def contains(self, other):
102-
if isinstance(other, (list, dict)):
103-
return Expression(self, JSONB_CONTAINS, Jsonb(other))
104-
elif isinstance(other, BinaryJSONField):
99+
if isinstance(other, BinaryJSONField):
105100
return Expression(self, JSONB_CONTAINS, other)
106-
return Expression(cast_jsonb(self), JSONB_EXISTS, other)
101+
return Expression(cast_jsonb(self), JSONB_CONTAINS, Jsonb(other))
107102

108103
def contained_by(self, other):
109104
return Expression(cast_jsonb(self), JSONB_CONTAINED_BY, Jsonb(other))

0 commit comments

Comments
 (0)