MCPcopy
hub / github.com/sqlalchemy/sqlalchemy / test_json_cant_contains

Method test_json_cant_contains

test/sql/test_operators.py:972–987  ·  view source on GitHub ↗

test the original case for #12736

(self, json_type)

Source from the content-addressed store, hash-verified

970
971 @testing.variation("json_type", ["plain", "with_variant"])
972 def test_json_cant_contains(self, json_type):
973 """test the original case for #12736"""
974
975 if json_type.plain:
976 type_ = JSON()
977 else:
978 type_ = JSON().with_variant(JSONB(), "postgresql")
979
980 with expect_deprecated(
981 r"Type object .*.JSON.* does not include operator "
982 r"'contains_op' in its operator classes."
983 ):
984 self.assert_compile(
985 column("xyz", type_).contains("{'foo': 'bar'}"),
986 "xyz LIKE '%' || :xyz_1 || '%'",
987 )
988
989 def test_invalid_op(self):
990 with expect_deprecated(

Callers

nothing calls this directly

Calls 7

JSONClass · 0.90
JSONBClass · 0.90
expect_deprecatedFunction · 0.90
columnFunction · 0.90
with_variantMethod · 0.80
assert_compileMethod · 0.80
containsMethod · 0.45

Tested by

no test coverage detected