Skip to content

Commit 2b3531f

Browse files
committed
Fixing new tests skip condition.
1 parent b3dca2f commit 2b3531f

File tree

2 files changed

+74
-48
lines changed

2 files changed

+74
-48
lines changed

tests/test_asyncio/test_vsets.py

Lines changed: 38 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ async def test_vsim_with_scores(d_client):
262262
assert 0 <= vsim["elem1"] <= 1
263263

264264

265-
@skip_if_server_version_lt("7.9.0")
265+
@skip_if_server_version_lt("8.2.0")
266266
async def test_vsim_with_attribs_attribs_set(d_client):
267267
elements_count = 5
268268
vector_dim = 10
@@ -284,7 +284,7 @@ async def test_vsim_with_attribs_attribs_set(d_client):
284284
assert vsim["elem2"] == attrs_dict
285285

286286

287-
@skip_if_server_version_lt("7.9.0")
287+
@skip_if_server_version_lt("8.2.0")
288288
async def test_vsim_with_scores_and_attribs_attribs_set(d_client):
289289
elements_count = 5
290290
vector_dim = 10
@@ -317,7 +317,7 @@ async def test_vsim_with_scores_and_attribs_attribs_set(d_client):
317317
assert vsim["elem2"]["attributes"] == attrs_dict
318318

319319

320-
@skip_if_server_version_lt("7.9.0")
320+
@skip_if_server_version_lt("8.2.0")
321321
async def test_vsim_with_attribs_attribs_not_set(d_client):
322322
elements_count = 20
323323
vector_dim = 50
@@ -859,6 +859,41 @@ async def test_vrandmember(d_client):
859859
assert members_list == []
860860

861861

862+
@skip_if_server_version_lt("8.2.0")
863+
async def test_8_2_new_vset_features_without_decoding_responces(client):
864+
# test vadd
865+
elements = ["elem1", "elem2", "elem3"]
866+
attrs_dict = {"key1": "value1", "key2": "value2"}
867+
for elem in elements:
868+
float_array = [random.uniform(0.5, 10) for x in range(0, 8)]
869+
resp = await client.vset().vadd(
870+
"myset", float_array, element=elem, attributes=attrs_dict
871+
)
872+
assert resp == 1
873+
874+
# test vsim with attributes
875+
vsim_with_attribs = await client.vset().vsim(
876+
"myset", input="elem1", with_attribs=True
877+
)
878+
assert len(vsim_with_attribs) == 3
879+
assert isinstance(vsim_with_attribs, dict)
880+
assert isinstance(vsim_with_attribs[b"elem1"], dict)
881+
assert vsim_with_attribs[b"elem1"] == attrs_dict
882+
883+
# test vsim with score and attributes
884+
vsim_with_scores_and_attribs = await client.vset().vsim(
885+
"myset", input="elem1", with_scores=True, with_attribs=True
886+
)
887+
assert len(vsim_with_scores_and_attribs) == 3
888+
assert isinstance(vsim_with_scores_and_attribs, dict)
889+
assert isinstance(vsim_with_scores_and_attribs[b"elem1"], dict)
890+
assert "score" in vsim_with_scores_and_attribs[b"elem1"]
891+
assert "attributes" in vsim_with_scores_and_attribs[b"elem1"]
892+
assert isinstance(vsim_with_scores_and_attribs[b"elem1"]["score"], float)
893+
assert isinstance(vsim_with_scores_and_attribs[b"elem1"]["attributes"], dict)
894+
assert vsim_with_scores_and_attribs[b"elem1"]["attributes"] == attrs_dict
895+
896+
862897
@skip_if_server_version_lt("7.9.0")
863898
async def test_vset_commands_without_decoding_responces(client):
864899
# test vadd
@@ -897,28 +932,6 @@ async def test_vset_commands_without_decoding_responces(client):
897932
assert isinstance(vsim_with_scores, dict)
898933
assert isinstance(vsim_with_scores[b"elem1"], float)
899934

900-
# test vsim with attributes
901-
vsim_with_attribs = await client.vset().vsim(
902-
"myset", input="elem1", with_attribs=True
903-
)
904-
assert len(vsim_with_attribs) == 3
905-
assert isinstance(vsim_with_attribs, dict)
906-
assert isinstance(vsim_with_attribs[b"elem1"], dict)
907-
assert vsim_with_attribs[b"elem1"] == attrs_dict
908-
909-
# test vsim with score and attributes
910-
vsim_with_scores_and_attribs = await client.vset().vsim(
911-
"myset", input="elem1", with_scores=True, with_attribs=True
912-
)
913-
assert len(vsim_with_scores_and_attribs) == 3
914-
assert isinstance(vsim_with_scores_and_attribs, dict)
915-
assert isinstance(vsim_with_scores_and_attribs[b"elem1"], dict)
916-
assert "score" in vsim_with_scores_and_attribs[b"elem1"]
917-
assert "attributes" in vsim_with_scores_and_attribs[b"elem1"]
918-
assert isinstance(vsim_with_scores_and_attribs[b"elem1"]["score"], float)
919-
assert isinstance(vsim_with_scores_and_attribs[b"elem1"]["attributes"], dict)
920-
assert vsim_with_scores_and_attribs[b"elem1"]["attributes"] == attrs_dict
921-
922935
# test vlinks - no scores
923936
element_links_all_layers = await client.vset().vlinks("myset", "elem1")
924937
assert len(element_links_all_layers) >= 1

tests/test_vsets.py

Lines changed: 36 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ def test_vsim_with_scores(d_client):
264264
assert 0 <= vsim["elem1"] <= 1
265265

266266

267-
@skip_if_server_version_lt("7.9.0")
267+
@skip_if_server_version_lt("8.2.0")
268268
def test_vsim_with_attribs_attribs_set(d_client):
269269
elements_count = 5
270270
vector_dim = 10
@@ -286,7 +286,7 @@ def test_vsim_with_attribs_attribs_set(d_client):
286286
assert vsim["elem2"] == attrs_dict
287287

288288

289-
@skip_if_server_version_lt("7.9.0")
289+
@skip_if_server_version_lt("8.2.0")
290290
def test_vsim_with_scores_and_attribs_attribs_set(d_client):
291291
elements_count = 5
292292
vector_dim = 10
@@ -319,7 +319,7 @@ def test_vsim_with_scores_and_attribs_attribs_set(d_client):
319319
assert vsim["elem2"]["attributes"] == attrs_dict
320320

321321

322-
@skip_if_server_version_lt("7.9.0")
322+
@skip_if_server_version_lt("8.2.0")
323323
def test_vsim_with_attribs_attribs_not_set(d_client):
324324
elements_count = 20
325325
vector_dim = 50
@@ -859,6 +859,39 @@ def test_vrandmember(d_client):
859859
assert members_list == []
860860

861861

862+
@skip_if_server_version_lt("8.2.0")
863+
def test_8_2_new_vset_features_without_decoding_responces(client):
864+
# test vadd
865+
elements = ["elem1", "elem2", "elem3"]
866+
attrs_dict = {"key1": "value1", "key2": "value2"}
867+
for elem in elements:
868+
float_array = [random.uniform(0.5, 10) for x in range(0, 8)]
869+
resp = client.vset().vadd(
870+
"myset", float_array, element=elem, attributes=attrs_dict
871+
)
872+
assert resp == 1
873+
874+
# test vsim with attributes
875+
vsim_with_attribs = client.vset().vsim("myset", input="elem1", with_attribs=True)
876+
assert len(vsim_with_attribs) == 3
877+
assert isinstance(vsim_with_attribs, dict)
878+
assert isinstance(vsim_with_attribs[b"elem1"], dict)
879+
assert vsim_with_attribs[b"elem1"] == attrs_dict
880+
881+
# test vsim with score and attributes
882+
vsim_with_scores_and_attribs = client.vset().vsim(
883+
"myset", input="elem1", with_scores=True, with_attribs=True
884+
)
885+
assert len(vsim_with_scores_and_attribs) == 3
886+
assert isinstance(vsim_with_scores_and_attribs, dict)
887+
assert isinstance(vsim_with_scores_and_attribs[b"elem1"], dict)
888+
assert "score" in vsim_with_scores_and_attribs[b"elem1"]
889+
assert "attributes" in vsim_with_scores_and_attribs[b"elem1"]
890+
assert isinstance(vsim_with_scores_and_attribs[b"elem1"]["score"], float)
891+
assert isinstance(vsim_with_scores_and_attribs[b"elem1"]["attributes"], dict)
892+
assert vsim_with_scores_and_attribs[b"elem1"]["attributes"] == attrs_dict
893+
894+
862895
@skip_if_server_version_lt("7.9.0")
863896
def test_vset_commands_without_decoding_responces(client):
864897
# test vadd
@@ -895,26 +928,6 @@ def test_vset_commands_without_decoding_responces(client):
895928
assert isinstance(vsim_with_scores, dict)
896929
assert isinstance(vsim_with_scores[b"elem1"], float)
897930

898-
# test vsim with attributes
899-
vsim_with_attribs = client.vset().vsim("myset", input="elem1", with_attribs=True)
900-
assert len(vsim_with_attribs) == 3
901-
assert isinstance(vsim_with_attribs, dict)
902-
assert isinstance(vsim_with_attribs[b"elem1"], dict)
903-
assert vsim_with_attribs[b"elem1"] == attrs_dict
904-
905-
# test vsim with score and attributes
906-
vsim_with_scores_and_attribs = client.vset().vsim(
907-
"myset", input="elem1", with_scores=True, with_attribs=True
908-
)
909-
assert len(vsim_with_scores_and_attribs) == 3
910-
assert isinstance(vsim_with_scores_and_attribs, dict)
911-
assert isinstance(vsim_with_scores_and_attribs[b"elem1"], dict)
912-
assert "score" in vsim_with_scores_and_attribs[b"elem1"]
913-
assert "attributes" in vsim_with_scores_and_attribs[b"elem1"]
914-
assert isinstance(vsim_with_scores_and_attribs[b"elem1"]["score"], float)
915-
assert isinstance(vsim_with_scores_and_attribs[b"elem1"]["attributes"], dict)
916-
assert vsim_with_scores_and_attribs[b"elem1"]["attributes"] == attrs_dict
917-
918931
# test vlinks - no scores
919932
element_links_all_layers = client.vset().vlinks("myset", "elem1")
920933
assert len(element_links_all_layers) >= 1

0 commit comments

Comments
 (0)