MCPcopy
hub / github.com/redis/redis-py / test_casesensitive

Method test_casesensitive

tests/test_search.py:1255–1285  ·  view source on GitHub ↗
(self, client)

Source from the content-addressed store, hash-verified

1253
1254 @pytest.mark.redismod
1255 def test_casesensitive(self, client):
1256 # create index
1257 SCHEMA = (TagField("t", case_sensitive=False),)
1258 client.ft().create_index(SCHEMA)
1259 client.ft().client.hset("1", "t", "HELLO")
1260 client.ft().client.hset("2", "t", "hello")
1261
1262 res = client.ft().search("@t:{HELLO}")
1263
1264 if expects_resp2_shape(client) or expects_unified_shape(client):
1265 assert 2 == len(res.docs)
1266 assert "1" == res.docs[0].id
1267 assert "2" == res.docs[1].id
1268 elif expects_resp3_shape(client):
1269 assert 2 == len(res["results"])
1270 assert "1" == res["results"][0]["id"]
1271 assert "2" == res["results"][1]["id"]
1272
1273 # create casesensitive index
1274 client.ft().dropindex()
1275 SCHEMA = (TagField("t", case_sensitive=True),)
1276 client.ft().create_index(SCHEMA)
1277 self.waitForIndex(client, getattr(client.ft(), "index_name", "idx"))
1278
1279 res = client.ft().search("@t:{HELLO}")
1280 if expects_resp2_shape(client) or expects_unified_shape(client):
1281 assert 1 == len(res.docs)
1282 assert "1" == res.docs[0].id
1283 elif expects_resp3_shape(client):
1284 assert 1 == len(res["results"])
1285 assert "1" == res["results"][0]["id"]
1286
1287 @pytest.mark.redismod
1288 @skip_ifmodversion_lt("2.2.0", "search")

Callers

nothing calls this directly

Calls 10

TagFieldClass · 0.90
expects_resp2_shapeFunction · 0.85
expects_unified_shapeFunction · 0.85
expects_resp3_shapeFunction · 0.85
create_indexMethod · 0.80
hsetMethod · 0.80
dropindexMethod · 0.80
ftMethod · 0.45
searchMethod · 0.45
waitForIndexMethod · 0.45

Tested by

no test coverage detected