Test JSON.SET with FPHA (FP Homogeneous Array) argument.
(client)
| 56 | @pytest.mark.redismod |
| 57 | @skip_if_server_version_lt("8.7.0") |
| 58 | def 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 |