Skip to content

Commit 278673e

Browse files
committed
Improve documentation and tests
Signed-off-by: BoazBD <[email protected]>
1 parent b9b20cd commit 278673e

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

python/python/glide/async_commands/server_modules/json.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,6 @@ async def mget(
227227
228228
Returns:
229229
List[Optional[bytes]]:
230-
List[Optional[bytes]]:
231230
For JSONPath (`path` starts with `$`):
232231
Returns a list of byte representations of the values found at the given path for each key.
233232
If `path` does not exist within the key, the entry will be an empty array.

python/python/tests/tests_server_modules/test_json.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,6 +237,15 @@ async def test_json_mget(self, glide_client: TGlideClient):
237237
expected_result = [b"2.5", b"4"]
238238
assert result == expected_result
239239

240+
# JSONPath that exists in only one of the keys
241+
result = await json.mget(
242+
glide_client,
243+
[key1, key2],
244+
"$.b.c",
245+
)
246+
expected_result = [b"[true]", b"[]"]
247+
assert result == expected_result
248+
240249
# Legacy path that exists in only one of the keys
241250
result = await json.mget(
242251
glide_client,
@@ -263,14 +272,22 @@ async def test_json_mget(self, glide_client: TGlideClient):
263272
)
264273
assert result == [None, None]
265274

266-
# One key doesn't exist
275+
# JSONPath one key doesn't exist
267276
result = await json.mget(
268277
glide_client,
269278
[key1, "{non_existing_key}"],
270279
"$.a",
271280
)
272281
assert result == [b"[1.0]", None]
273282

283+
# Legacy path one key doesn't exist
284+
result = await json.mget(
285+
glide_client,
286+
[key1, "{non_existing_key}"],
287+
".a",
288+
)
289+
assert result == [b"1.0", None]
290+
274291
# Both keys don't exist
275292
result = await json.mget(
276293
glide_client,

0 commit comments

Comments
 (0)