@@ -275,7 +275,6 @@ def test_objlen(client):
275
275
assert len (obj ) == client .json ().objlen ("obj" )
276
276
277
277
278
- @pytest .mark .pipeline
279
278
@pytest .mark .redismod
280
279
def test_json_commands_in_pipeline (client ):
281
280
p = client .json ().pipeline ()
@@ -290,8 +289,9 @@ def test_json_commands_in_pipeline(client):
290
289
client .flushdb ()
291
290
p = client .json ().pipeline ()
292
291
d = {"hello" : "world" , "oh" : "snap" }
293
- p .jsonset ("foo" , Path .rootPath (), d )
294
- p .jsonget ("foo" )
292
+ with pytest .deprecated_call ():
293
+ p .jsonset ("foo" , Path .rootPath (), d )
294
+ p .jsonget ("foo" )
295
295
p .exists ("notarealkey" )
296
296
p .delete ("foo" )
297
297
assert [True , d , 0 , 1 ] == p .execute ()
@@ -463,14 +463,18 @@ def test_numby_commands_dollar(client):
463
463
client .json ().set ("doc1" , "$" , {"a" : "b" , "b" : [
464
464
{"a" : 2 }, {"a" : 5.0 }, {"a" : "c" }]})
465
465
466
- assert client .json ().nummultby ("doc1" , "$..a" , 2 ) == \
467
- [None , 4 , 10 , None ]
468
- assert client .json ().nummultby ("doc1" , "$..a" , 2.5 ) == \
469
- [None , 10.0 , 25.0 , None ]
466
+ # test list
467
+ with pytest .deprecated_call ():
468
+ assert client .json ().nummultby ("doc1" , "$..a" , 2 ) == \
469
+ [None , 4 , 10 , None ]
470
+ assert client .json ().nummultby ("doc1" , "$..a" , 2.5 ) == \
471
+ [None , 10.0 , 25.0 , None ]
472
+
470
473
# Test single
471
- assert client .json ().nummultby ("doc1" , "$.b[1].a" , 2 ) == [50.0 ]
472
- assert client .json ().nummultby ("doc1" , "$.b[2].a" , 2 ) == [None ]
473
- assert client .json ().nummultby ("doc1" , "$.b[1].a" , 3 ) == [150.0 ]
474
+ with pytest .deprecated_call ():
475
+ assert client .json ().nummultby ("doc1" , "$.b[1].a" , 2 ) == [50.0 ]
476
+ assert client .json ().nummultby ("doc1" , "$.b[2].a" , 2 ) == [None ]
477
+ assert client .json ().nummultby ("doc1" , "$.b[1].a" , 3 ) == [150.0 ]
474
478
475
479
# test missing keys
476
480
with pytest .raises (exceptions .ResponseError ):
@@ -485,7 +489,9 @@ def test_numby_commands_dollar(client):
485
489
# Test legacy NUMMULTBY
486
490
client .json ().set ("doc1" , "$" , {"a" : "b" , "b" : [
487
491
{"a" : 2 }, {"a" : 5.0 }, {"a" : "c" }]})
488
- client .json ().nummultby ("doc1" , ".b[0].a" , 3 ) == 6
492
+
493
+ with pytest .deprecated_call ():
494
+ client .json ().nummultby ("doc1" , ".b[0].a" , 3 ) == 6
489
495
490
496
491
497
@pytest .mark .redismod
@@ -824,9 +830,11 @@ def test_objkeys_dollar(client):
824
830
# Test missing key
825
831
assert client .json ().objkeys ("non_existing_doc" , "..a" ) is None
826
832
827
- # Test missing key
833
+ # Test non existing doc
828
834
with pytest .raises (exceptions .ResponseError ):
829
- client .json ().objkeys ("doc1" , "$.nowhere" )
835
+ assert client .json ().objkeys ("non_existing_doc" , "$..a" ) == []
836
+
837
+ assert client .json ().objkeys ("doc1" , "$..nowhere" ) == []
830
838
831
839
832
840
@pytest .mark .redismod
@@ -845,12 +853,11 @@ def test_objlen_dollar(client):
845
853
# Test single
846
854
assert client .json ().objlen ("doc1" , "$.nested1.a" ) == [2 ]
847
855
848
- # Test missing key
849
- assert client .json ().objlen ("non_existing_doc" , "$..a" ) is None
850
-
851
- # Test missing path
856
+ # Test missing key, and path
852
857
with pytest .raises (exceptions .ResponseError ):
853
- client .json ().objlen ("doc1" , "$.nowhere" )
858
+ client .json ().objlen ("non_existing_doc" , "$..a" )
859
+
860
+ assert client .json ().objlen ("doc1" , "$.nowhere" ) == []
854
861
855
862
# Test legacy
856
863
assert client .json ().objlen ("doc1" , ".*.a" ) == 2
@@ -862,8 +869,8 @@ def test_objlen_dollar(client):
862
869
assert client .json ().objlen ("non_existing_doc" , "..a" ) is None
863
870
864
871
# Test missing path
865
- with pytest .raises (exceptions .ResponseError ):
866
- client .json ().objlen ("doc1" , ".nowhere" )
872
+ # with pytest.raises(exceptions.ResponseError):
873
+ client .json ().objlen ("doc1" , ".nowhere" )
867
874
868
875
869
876
@pytest .mark .redismod
@@ -1143,11 +1150,11 @@ def test_resp_dollar(client):
1143
1150
]
1144
1151
1145
1152
# Test missing path
1146
- with pytest .raises (exceptions .ResponseError ):
1147
- client .json ().resp ("doc1" , "$.nowhere" )
1153
+ client .json ().resp ("doc1" , "$.nowhere" )
1148
1154
1149
1155
# Test missing key
1150
- assert client .json ().resp ("non_existing_doc" , "$..a" ) is None
1156
+ # with pytest.raises(exceptions.ResponseError):
1157
+ client .json ().resp ("non_existing_doc" , "$..a" )
1151
1158
1152
1159
1153
1160
@pytest .mark .redismod
0 commit comments