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

Method test_profile_limited

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

Source from the content-addressed store, hash-verified

2755 @skip_if_server_version_gte("7.9.0")
2756 @skip_if_server_version_lt("6.3.0")
2757 def test_profile_limited(self, client):
2758 client.ft().create_index((TextField("t"),))
2759 client.ft().client.hset("1", "t", "hello")
2760 client.ft().client.hset("2", "t", "hell")
2761 client.ft().client.hset("3", "t", "help")
2762 client.ft().client.hset("4", "t", "helowa")
2763
2764 q = Query("%hell% hel*")
2765 if expects_resp2_shape(client) or expects_unified_shape(client):
2766 res, det = client.ft().profile(q, limited=True)
2767 det = det.info
2768 assert det[4][1][7][9] == "The number of iterators in the union is 3"
2769 assert det[4][1][8][9] == "The number of iterators in the union is 4"
2770 assert det[4][1][1] == "INTERSECT"
2771 assert len(res.docs) == 3 # check also the search result
2772 elif expects_resp3_shape(client):
2773 res = client.ft().profile(q, limited=True)
2774 res = res.info
2775 iterators_profile = res["profile"]["Iterators profile"]
2776 assert (
2777 iterators_profile[0]["Child iterators"][0]["Child iterators"]
2778 == "The number of iterators in the union is 3"
2779 )
2780 assert (
2781 iterators_profile[0]["Child iterators"][1]["Child iterators"]
2782 == "The number of iterators in the union is 4"
2783 )
2784 assert iterators_profile[0]["Type"] == "INTERSECT"
2785 assert len(res["results"]) == 3 # check also the search result
2786
2787 @pytest.mark.redismod
2788 @skip_ifmodversion_lt("2.4.3", "search")

Callers

nothing calls this directly

Calls 9

TextFieldClass · 0.90
QueryClass · 0.90
expects_resp2_shapeFunction · 0.85
expects_unified_shapeFunction · 0.85
expects_resp3_shapeFunction · 0.85
create_indexMethod · 0.80
hsetMethod · 0.80
profileMethod · 0.80
ftMethod · 0.45

Tested by

no test coverage detected