summaryrefslogtreecommitdiff
path: root/tests/test_json.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/test_json.py')
-rw-r--r--tests/test_json.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/test_json.py b/tests/test_json.py
index b3f38f7..abc5776 100644
--- a/tests/test_json.py
+++ b/tests/test_json.py
@@ -1003,6 +1003,7 @@ def test_debug_dollar(client):
assert client.json().debug("MEMORY", "non_existing_doc", "$..a") == []
+@pytest.mark.redismod
def test_resp_dollar(client):
data = {
@@ -1149,6 +1150,7 @@ def test_resp_dollar(client):
assert client.json().resp("non_existing_doc", "$..a") is None
+@pytest.mark.redismod
def test_arrindex_dollar(client):
client.json().set(
@@ -1397,3 +1399,18 @@ def test_decoders_and_unstring():
assert decode_list(b"45.55") == 45.55
assert decode_list("45.55") == 45.55
assert decode_list(['hello', b'world']) == ['hello', 'world']
+
+
+@pytest.mark.redismod
+def test_custom_decoder(client):
+ import ujson
+ import json
+
+ cj = client.json(encoder=ujson, decoder=ujson)
+ assert cj.set("foo", Path.rootPath(), "bar")
+ assert "bar" == cj.get("foo")
+ assert cj.get("baz") is None
+ assert 1 == cj.delete("foo")
+ assert client.exists("foo") == 0
+ assert not isinstance(cj.__encoder__, json.JSONEncoder)
+ assert not isinstance(cj.__decoder__, json.JSONDecoder)