@@ -641,7 +641,7 @@ def testObjKeysCommand(env):
641
641
r .assertEqual (res , None )
642
642
643
643
# Test missing key
644
- r .expect ( 'JSON.OBJKEYS' , 'doc1' , '$.nowhere' ). raiseError ( )
644
+ r .assertEqual ( r . execute_command ( 'JSON.OBJKEYS' , 'doc1' , '$.nowhere' ), [] )
645
645
646
646
# Test default path
647
647
res = r .execute_command ('JSON.OBJKEYS' , 'doc1' )
@@ -664,7 +664,7 @@ def testObjLenCommand(env):
664
664
r .expect ('JSON.OBJLEN' , 'non_existing_doc' , '$..a' ).raiseError ().contains ("does not exist" )
665
665
666
666
# Test missing path
667
- r .expect ( 'JSON.OBJLEN' , 'doc1' , '$.nowhere' ). raiseError (). contains ( "does not exist" )
667
+ r .assertEqual ( r . execute_command ( 'JSON.OBJLEN' , 'doc1' , '$.nowhere' ), [] )
668
668
669
669
670
670
# Test legacy
@@ -858,7 +858,7 @@ def testRespCommand(env):
858
858
r .assertEqual (resSingle , [['{' , 'A1_B1' , 10 , 'A1_B2' , 'false' , 'A1_B3' , ['{' , 'A1_B3_C1' , None , 'A1_B3_C2' , ['[' , 'A1_B3_C2_D1_1' , 'A1_B3_C2_D1_2' , '-19.5' , 'A1_B3_C2_D1_4' , 'A1_B3_C2_D1_5' , ['{' , 'A1_B3_C2_D1_6_E1' , 'true' ]], 'A1_B3_C3' , ['[' , 1 ]], 'A1_B4' , ['{' , 'A1_B4_C1' , 'foo' ]]])
859
859
860
860
# Test missing path
861
- r .expect ( 'JSON.RESP' , 'doc1' , '$.nowhere' ). raiseError ( )
861
+ r .assertEqual ( r . execute_command ( 'JSON.RESP' , 'doc1' , '$.nowhere' ), [] )
862
862
863
863
# Test missing key
864
864
res = r .execute_command ('JSON.RESP' , 'non_existing_doc' , '$..a' )
@@ -984,7 +984,7 @@ def testErrorMessage(env):
984
984
985
985
# ARRAPPEND
986
986
r .assertEqual (r .execute_command ('JSON.ARRAPPEND' , 'doc1' , '$.string' , '"abc"' ), [None ])
987
- r .expect ( 'JSON.ARRAPPEND' , 'doc1' , '$.nowhere' , '"abc"' ). raiseError (). contains ( "does not exist" )
987
+ r .assertEqual ( r . execute_command ( 'JSON.ARRAPPEND' , 'doc1' , '$.nowhere' , '"abc"' ), [] )
988
988
r .expect ('JSON.ARRAPPEND' , 'doc_none' , '$.string' , '"abc"' ).raiseError ().contains ("doesn't exist" )
989
989
r .expect ('JSON.ARRAPPEND' , 'hash_key' , '$.string' , '"abc"' ).raiseError ().contains ("wrong Redis type" )
990
990
@@ -1004,7 +1004,7 @@ def testErrorMessage(env):
1004
1004
1005
1005
# ARRPOP
1006
1006
r .assertEqual (r .execute_command ('JSON.ARRPOP' , 'doc1' , '$.string' , '"abc"' ), [None ])
1007
- r .expect ( 'JSON.ARRPOP' , 'doc1' , '$.nowhere' , '"abc"' ). raiseError (). contains ( "does not exist" )
1007
+ r .assertEqual ( r . execute_command ( 'JSON.ARRPOP' , 'doc1' , '$.nowhere' , '"abc"' ), [] )
1008
1008
r .expect ('JSON.ARRPOP' , 'doc_none' , '$..string' , '"abc"' ).raiseError ().contains ("doesn't exist" )
1009
1009
r .expect ('JSON.ARRPOP' , 'hash_key' , '$..string' , '"abc"' ).raiseError ().contains ("wrong Redis type" )
1010
1010
@@ -1024,7 +1024,7 @@ def testErrorMessage(env):
1024
1024
1025
1025
# ARRINDEX
1026
1026
r .assertEqual (r .execute_command ('JSON.ARRINDEX' , 'doc1' , '$.number' , '"abc"' ), [None ])
1027
- r .expect ( 'JSON.ARRINDEX' , 'doc1' , '$.nowhere' , '"abc"' ). raiseError (). contains ( "does not exist" )
1027
+ r .assertEqual ( r . execute_command ( 'JSON.ARRINDEX' , 'doc1' , '$.nowhere' , '"abc"' ), [] )
1028
1028
r .expect ('JSON.ARRINDEX' , 'doc_none' , '$.number' , '"abc"' ).raiseError ().contains ("does not exist" )
1029
1029
r .expect ('JSON.ARRINDEX' , 'hash_key' , '$.number' , '"abc"' ).raiseError ().contains ("wrong Redis type" )
1030
1030
@@ -1044,7 +1044,7 @@ def testErrorMessage(env):
1044
1044
1045
1045
# ARRINSERT
1046
1046
r .assertEqual (r .execute_command ('JSON.ARRINSERT' , 'doc1' , '$.string' , 0 , '"abc"' ), [None ])
1047
- r .expect ( 'JSON.ARRINSERT' , 'doc1' , '$.nowhere' , 0 , '"abc"' ). raiseError (). contains ( "does not exist" )
1047
+ r .assertEqual ( r . execute_command ( 'JSON.ARRINSERT' , 'doc1' , '$.nowhere' , 0 , '"abc"' ), [] )
1048
1048
r .expect ('JSON.ARRINSERT' , 'doc_none' , '$.string' , 0 , '"abc"' ).raiseError ().contains ("doesn't exist" )
1049
1049
r .expect ('JSON.ARRINSERT' , 'hash_key' , '$.string' , 0 , '"abc"' ).raiseError ().contains ("wrong Redis type" )
1050
1050
@@ -1064,7 +1064,7 @@ def testErrorMessage(env):
1064
1064
1065
1065
# ARRLEN
1066
1066
r .assertEqual (r .execute_command ('JSON.ARRLEN' , 'doc1' , '$.string' , '"abc"' ), [None ])
1067
- r .expect ( 'JSON.ARRLEN' , 'doc1' , '$.nowhere' , '"abc"' ). raiseError (). contains ( "does not exist" )
1067
+ r .assertEqual ( r . execute_command ( 'JSON.ARRLEN' , 'doc1' , '$.nowhere' , '"abc"' ), [] )
1068
1068
r .expect ('JSON.ARRLEN' , 'doc_none' , '$.string' , '"abc"' ).raiseError ().contains ("doesn't exist" )
1069
1069
r .expect ('JSON.ARRLEN' , 'hash_key' , '$.string' , '"abc"' ).raiseError ().contains ("wrong Redis type" )
1070
1070
@@ -1084,7 +1084,7 @@ def testErrorMessage(env):
1084
1084
1085
1085
# ARRTRIM
1086
1086
r .assertEqual (r .execute_command ('JSON.ARRTRIM' , 'doc1' , '$.string' , 0 , 1 ), [None ])
1087
- r .expect ( 'JSON.ARRTRIM' , 'doc1' , '$.nowhere' , 0 , 1 ). raiseError (). contains ( "does not exist" )
1087
+ r .assertEqual ( r . execute_command ( 'JSON.ARRTRIM' , 'doc1' , '$.nowhere' , 0 , 1 ), [] )
1088
1088
r .expect ('JSON.ARRTRIM' , 'doc_none' , '$.string' , 0 , 1 ).raiseError ().contains ("doesn't exist" )
1089
1089
r .expect ('JSON.ARRTRIM' , 'hash_key' , '$.string' , 0 , 1 ).raiseError ().contains ("wrong Redis type" )
1090
1090
@@ -1104,7 +1104,7 @@ def testErrorMessage(env):
1104
1104
1105
1105
# OBJKEYS
1106
1106
r .assertEqual (r .execute_command ('JSON.OBJKEYS' , 'doc1' , '$.string' ), [None ])
1107
- r .expect ( 'JSON.OBJKEYS' , 'doc1' , '$.nowhere' ). raiseError (). contains ( "does not exist" )
1107
+ r .assertEqual ( r . execute_command ( 'JSON.OBJKEYS' , 'doc1' , '$.nowhere' ), [] )
1108
1108
r .expect ('JSON.OBJKEYS' , 'doc_none' , '$.string' ).raiseError ().contains ("doesn't exist" )
1109
1109
r .expect ('JSON.OBJKEYS' , 'hash_key' , '$.string' ).raiseError ().contains ("wrong Redis type" )
1110
1110
@@ -1124,7 +1124,7 @@ def testErrorMessage(env):
1124
1124
1125
1125
# OBJLEN
1126
1126
r .assertEqual (r .execute_command ('JSON.OBJLEN' , 'doc1' , '$.string' ), [None ])
1127
- r .expect ( 'JSON.OBJLEN' , 'doc1' , '$.nowhere' ). raiseError (). contains ( "does not exist" )
1127
+ r .assertEqual ( r . execute_command ( 'JSON.OBJLEN' , 'doc1' , '$.nowhere' ), [] )
1128
1128
r .expect ('JSON.OBJLEN' , 'doc_none' , '$.string' ).raiseError ().contains ("does not exist" )
1129
1129
r .expect ('JSON.OBJLEN' , 'hash_key' , '.string' ).raiseError ().contains ("wrong Redis type" )
1130
1130
@@ -1144,7 +1144,7 @@ def testErrorMessage(env):
1144
1144
1145
1145
# NUMINCRBY
1146
1146
r .assertEqual (r .execute_command ('JSON.NUMINCRBY' , 'doc1' , '$.string' , 3 ), '[null]' )
1147
- r .expect ( 'JSON.NUMINCRBY' , 'doc1' , '$.nowhere' , 3 ). raiseError (). contains ( "does not exist" )
1147
+ r .assertEqual ( r . execute_command ( 'JSON.NUMINCRBY' , 'doc1' , '$.nowhere' , 3 ), '[]' )
1148
1148
r .expect ('JSON.NUMINCRBY' , 'doc_none' , '$.string' , 3 ).raiseError ().contains ("doesn't exist" )
1149
1149
r .expect ('JSON.NUMINCRBY' , 'hash_key' , '$.string' , 3 ).raiseError ().contains ("wrong Redis type" )
1150
1150
@@ -1165,7 +1165,7 @@ def testErrorMessage(env):
1165
1165
1166
1166
# NUMMULTBY
1167
1167
r .assertEqual (r .execute_command ('JSON.NUMMULTBY' , 'doc1' , '$.string' , 3 ), '[null]' )
1168
- r .expect ( 'JSON.NUMMULTBY' , 'doc1' , '$.nowhere' , 3 ). raiseError (). contains ( "does not exist" )
1168
+ r .assertEqual ( r . execute_command ( 'JSON.NUMMULTBY' , 'doc1' , '$.nowhere' , 3 ), '[]' )
1169
1169
r .expect ('JSON.NUMMULTBY' , 'doc_none' , '$.string' , 3 ).raiseError ().contains ("doesn't exist" )
1170
1170
r .expect ('JSON.NUMMULTBY' , 'hash_key' , '$.string' , 3 ).raiseError ().contains ("wrong Redis type" )
1171
1171
@@ -1185,7 +1185,7 @@ def testErrorMessage(env):
1185
1185
1186
1186
# STRAPPEND
1187
1187
r .assertEqual (r .execute_command ('JSON.STRAPPEND' , 'doc1' , '$.number' , '"abc"' ), [None ])
1188
- r .expect ( 'JSON.STRAPPEND' , 'doc1' , '$.nowhere' , '"abc"' ). raiseError (). contains ( "does not exist" )
1188
+ r .assertEqual ( r . execute_command ( 'JSON.STRAPPEND' , 'doc1' , '$.nowhere' , '"abc"' ), [] )
1189
1189
r .expect ('JSON.STRAPPEND' , 'doc_none' , '$.number' , '"abc"' ).raiseError ().contains ("doesn't exist" )
1190
1190
r .expect ('JSON.STRAPPEND' , 'hash_key' , '$.number' , '"abc"' ).raiseError ().contains ("wrong Redis type" )
1191
1191
@@ -1206,7 +1206,7 @@ def testErrorMessage(env):
1206
1206
1207
1207
# STRLEN
1208
1208
r .assertEqual (r .execute_command ('JSON.STRLEN' , 'doc1' , '$.object' , '"abc"' ), [None ])
1209
- r .expect ( 'JSON.STRLEN' , 'doc1' , '$.nowhere' , '"abc"' ). raiseError (). contains ( "does not exist" )
1209
+ r .assertEqual ( r . execute_command ( 'JSON.STRLEN' , 'doc1' , '$.nowhere' , '"abc"' ), [] )
1210
1210
r .expect ('JSON.STRLEN' , 'doc_none' , '$.object' , '"abc"' ).raiseError ().contains ("doesn't exist" )
1211
1211
r .expect ('JSON.STRLEN' , 'hash_key' , '$.object' , '"abc"' ).raiseError ().contains ("wrong Redis type" )
1212
1212
@@ -1226,7 +1226,7 @@ def testErrorMessage(env):
1226
1226
1227
1227
# TOGGLE
1228
1228
r .assertEqual (r .execute_command ('JSON.TOGGLE' , 'doc1' , '$.object' ), [None ])
1229
- r .expect ( 'JSON.TOGGLE' , 'doc1' , '$.nowhere' ). raiseError (). contains ( "does not exist" )
1229
+ r .assertEqual ( r . execute_command ( 'JSON.TOGGLE' , 'doc1' , '$.nowhere' ), [] )
1230
1230
r .expect ('JSON.TOGGLE' , 'doc_none' , '$.object' ).raiseError ().contains ("doesn't exist" )
1231
1231
r .expect ('JSON.TOGGLE' , 'hash_key' , '$.object' ).raiseError ().contains ("wrong Redis type" )
1232
1232
@@ -1273,7 +1273,7 @@ def testErrorMessage(env):
1273
1273
"""
1274
1274
1275
1275
# RESP
1276
- r .expect ( 'JSON.RESP' , 'doc1' , '$.nowhere' ). raiseError (). contains ( "does not exist" )
1276
+ r .assertEqual ( r . execute_command ( 'JSON.RESP' , 'doc1' , '$.nowhere' ), [] )
1277
1277
r .assertEqual (r .execute_command ('JSON.RESP' , 'doc_none' , '$.object' ), None )
1278
1278
r .assertEqual (r .execute_command ('JSON.RESP' , 'doc_none' , '$.object' ), None )
1279
1279
r .expect ('JSON.RESP' , 'hash_key' , '$.object' ).raiseError ().contains ("wrong Redis type" )
0 commit comments