@@ -104,7 +104,7 @@ def test_jsonsetexistentialmodifiersshouldsucceed(client):
104104 assert client .json ().set ("obj" , Path ("foo" ), "baz" , xx = True )
105105 assert client .json ().set ("obj" , Path ("qaz" ), "baz" , nx = True )
106106
107- # Test that flags are mutually exlusive
107+ # Test that flags are mutually exclusive
108108 with pytest .raises (Exception ):
109109 client .json ().set ("obj" , Path ("foo" ), "baz" , nx = True , xx = True )
110110
@@ -453,6 +453,7 @@ def test_json_forget_with_dollar(client):
453453 client .json ().forget ("not_a_document" , "..a" )
454454
455455
456+ @pytest .mark .onlynoncluster
456457@pytest .mark .redismod
457458def test_json_mget_dollar (client ):
458459 # Test mget with multi paths
@@ -473,14 +474,14 @@ def test_json_mget_dollar(client):
473474 assert_resp_response (client , client .json ().get ("doc2" , "$..a" ), res , [res ])
474475
475476 # Test mget with single path
476- client .json ().mget ("doc1" , "$..a" ) == [1 , 3 , None ]
477+ assert client .json ().mget ([ "doc1" ] , "$..a" ) == [[ 1 , 3 , None ] ]
477478 # Test mget with multi path
478- client .json ().mget (["doc1" , "doc2" ], "$..a" ) == [[1 , 3 , None ], [4 , 6 , [None ]]]
479+ res = [[1 , 3 , None ], [4 , 6 , [None ]]]
480+ assert client .json ().mget (["doc1" , "doc2" ], "$..a" ) == res
479481
480482 # Test missing key
481- client .json ().mget (["doc1" , "missing_doc" ], "$..a" ) == [[1 , 3 , None ], None ]
482- res = client .json ().mget (["missing_doc1" , "missing_doc2" ], "$..a" )
483- assert res == [None , None ]
483+ assert client .json ().mget (["doc1" , "missing_doc" ], "$..a" ) == [[1 , 3 , None ], None ]
484+ assert client .json ().mget (["missing_doc1" , "missing_doc2" ], "$..a" ) == [None , None ]
484485
485486
486487@pytest .mark .redismod
@@ -518,13 +519,13 @@ def test_numby_commands_dollar(client):
518519
519520 # Test legacy NUMINCRBY
520521 client .json ().set ("doc1" , "$" , {"a" : "b" , "b" : [{"a" : 2 }, {"a" : 5.0 }, {"a" : "c" }]})
521- client .json ().numincrby ("doc1" , ".b[0].a" , 3 ) == 5
522+ assert client .json ().numincrby ("doc1" , ".b[0].a" , 3 ) == 5
522523
523524 # Test legacy NUMMULTBY
524525 client .json ().set ("doc1" , "$" , {"a" : "b" , "b" : [{"a" : 2 }, {"a" : 5.0 }, {"a" : "c" }]})
525526
526527 with pytest .deprecated_call ():
527- client .json ().nummultby ("doc1" , ".b[0].a" , 3 ) == 6
528+ assert client .json ().nummultby ("doc1" , ".b[0].a" , 3 ) == 6
528529
529530
530531@pytest .mark .redismod
@@ -533,25 +534,25 @@ def test_strappend_dollar(client):
533534 "doc1" , "$" , {"a" : "foo" , "nested1" : {"a" : "hello" }, "nested2" : {"a" : 31 }}
534535 )
535536 # Test multi
536- client .json ().strappend ("doc1" , "bar" , "$..a" ) == [6 , 8 , None ]
537+ assert client .json ().strappend ("doc1" , "bar" , "$..a" ) == [6 , 8 , None ]
537538
538- # res = [{"a": "foobar", "nested1": {"a": "hellobar"}, "nested2": {"a": 31}}]
539- # assert_resp_response(client, client.json().get("doc1", "$"), res, [res])
539+ res = [{"a" : "foobar" , "nested1" : {"a" : "hellobar" }, "nested2" : {"a" : 31 }}]
540+ assert_resp_response (client , client .json ().get ("doc1" , "$" ), res , [res ])
540541
541542 # Test single
542- client .json ().strappend ("doc1" , "baz" , "$.nested1.a" ) == [11 ]
543+ assert client .json ().strappend ("doc1" , "baz" , "$.nested1.a" ) == [11 ]
543544
544- # res = [{"a": "foobar", "nested1": {"a": "hellobarbaz"}, "nested2": {"a": 31}}]
545- # assert_resp_response(client, client.json().get("doc1", "$"), res, [res])
545+ res = [{"a" : "foobar" , "nested1" : {"a" : "hellobarbaz" }, "nested2" : {"a" : 31 }}]
546+ assert_resp_response (client , client .json ().get ("doc1" , "$" ), res , [res ])
546547
547548 # Test missing key
548549 with pytest .raises (exceptions .ResponseError ):
549550 client .json ().strappend ("non_existing_doc" , "$..a" , "err" )
550551
551552 # Test multi
552- client .json ().strappend ("doc1" , "bar" , ".*.a" ) == 8
553- # res = [{"a": "foo ", "nested1": {"a": "hellobar "}, "nested2": {"a": 31}}]
554- # assert_resp_response(client, client.json().get("doc1", "$"), res, [res])
553+ assert client .json ().strappend ("doc1" , "bar" , ".*.a" ) == 14
554+ res = [{"a" : "foobar " , "nested1" : {"a" : "hellobarbazbar " }, "nested2" : {"a" : 31 }}]
555+ assert_resp_response (client , client .json ().get ("doc1" , "$" ), res , [res ])
555556
556557 # Test missing path
557558 with pytest .raises (exceptions .ResponseError ):
@@ -571,8 +572,8 @@ def test_strlen_dollar(client):
571572 assert res1 == res2
572573
573574 # Test single
574- client .json ().strlen ("doc1" , "$.nested1.a" ) == [8 ]
575- client .json ().strlen ("doc1" , "$.nested2.a" ) == [None ]
575+ assert client .json ().strlen ("doc1" , "$.nested1.a" ) == [8 ]
576+ assert client .json ().strlen ("doc1" , "$.nested2.a" ) == [None ]
576577
577578 # Test missing key
578579 with pytest .raises (exceptions .ResponseError ):
@@ -591,7 +592,7 @@ def test_arrappend_dollar(client):
591592 },
592593 )
593594 # Test multi
594- client .json ().arrappend ("doc1" , "$..a" , "bar" , "racuda" ) == [3 , 5 , None ]
595+ assert client .json ().arrappend ("doc1" , "$..a" , "bar" , "racuda" ) == [3 , 5 , None ]
595596 res = [
596597 {
597598 "a" : ["foo" , "bar" , "racuda" ],
@@ -775,7 +776,7 @@ def test_arrpop_dollar(client):
775776 },
776777 )
777778 # Test multi (all paths are updated, but return result of last path)
778- client .json ().arrpop ("doc1" , "..a" , "1" ) is None
779+ assert client .json ().arrpop ("doc1" , "..a" , "1" ) == "null"
779780 res = [{"a" : [], "nested1" : {"a" : ["hello" , "world" ]}, "nested2" : {"a" : 31 }}]
780781 assert_resp_response (client , client .json ().get ("doc1" , "$" ), res , [res ])
781782
0 commit comments