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

Function test_json_set_fpha

tests/test_json.py:58–83  ·  view source on GitHub ↗

Test JSON.SET with FPHA (FP Homogeneous Array) argument.

(client)

Source from the content-addressed store, hash-verified

56@pytest.mark.redismod
57@skip_if_server_version_lt("8.7.0")
58def test_json_set_fpha(client):
59 """Test JSON.SET with FPHA (FP Homogeneous Array) argument."""
60 # Set a JSON value with an FP array using FP32
61 fp_array = [1.1, 2.2, 3.3, 4.4]
62 assert client.json().set("fpha_key", Path.root_path(), fp_array, fpha="FP32")
63 result = client.json().get("fpha_key", Path.root_path())
64 assert isinstance(result, list)
65 assert len(result) == 4
66
67 # Test with FP64
68 assert client.json().set("fpha_key64", Path.root_path(), fp_array, fpha="FP64")
69 result = client.json().get("fpha_key64", Path.root_path())
70 assert isinstance(result, list)
71 assert len(result) == 4
72
73 # Test with FP16
74 assert client.json().set("fpha_key16", Path.root_path(), fp_array, fpha="FP16")
75 result = client.json().get("fpha_key16", Path.root_path())
76 assert isinstance(result, list)
77 assert len(result) == 4
78
79 # Test with BF16
80 assert client.json().set("fpha_keybf16", Path.root_path(), fp_array, fpha="BF16")
81 result = client.json().get("fpha_keybf16", Path.root_path())
82 assert isinstance(result, list)
83 assert len(result) == 4
84
85
86@pytest.mark.redismod

Callers

nothing calls this directly

Calls 4

root_pathMethod · 0.80
setMethod · 0.45
jsonMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected