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

Function test_vsim_count

tests/test_vsets.py:214–244  ·  view source on GitHub ↗
(d_client)

Source from the content-addressed store, hash-verified

212
213@skip_if_server_version_lt("7.9.0")
214def test_vsim_count(d_client):
215 elements_count = 30
216 vector_dim = 800
217 for i in range(elements_count):
218 float_array = [random.uniform(0, 10) for x in range(vector_dim)]
219 d_client.vset().vadd(
220 "myset",
221 float_array,
222 f"elem{i}",
223 numlinks=64,
224 )
225
226 vsim = d_client.vset().vsim("myset", input="elem1")
227 assert len(vsim) == 10
228 assert isinstance(vsim, list)
229 assert isinstance(vsim[0], str)
230
231 vsim = d_client.vset().vsim("myset", input="elem1", count=5)
232 assert len(vsim) == 5
233 assert isinstance(vsim, list)
234 assert isinstance(vsim[0], str)
235
236 vsim = d_client.vset().vsim("myset", input="elem1", count=50)
237 assert len(vsim) == 30
238 assert isinstance(vsim, list)
239 assert isinstance(vsim[0], str)
240
241 vsim = d_client.vset().vsim("myset", input="elem1", count=15)
242 assert len(vsim) == 15
243 assert isinstance(vsim, list)
244 assert isinstance(vsim[0], str)
245
246
247@skip_if_server_version_lt("7.9.0")

Callers

nothing calls this directly

Calls 3

vaddMethod · 0.80
vsimMethod · 0.80
vsetMethod · 0.45

Tested by

no test coverage detected