@@ -32,42 +32,42 @@ def __init__(self):
32
32
def test_redis_error (self ):
33
33
try :
34
34
self .con .execute_command (
35
- 'AI.SCRIPTRUN ' , 'redis_scripts' , 'test_redis_error' )
35
+ 'AI.SCRIPTEXECUTE ' , 'redis_scripts' , 'test_redis_error' , 'KEYS' , 1 , "x{1}" )
36
36
self .env .assertTrue (False )
37
37
except :
38
38
pass
39
39
40
40
def test_simple_test_set (self ):
41
41
self .con .execute_command (
42
- 'AI.SCRIPTRUN ' , 'redis_scripts{1}' , 'test_set_key' )
42
+ 'AI.SCRIPTEXECUTE ' , 'redis_scripts{1}' , 'test_set_key' , 'KEYS' , 1 , "x{1}" )
43
43
self .env .assertEqual (b"1" , self .con .get ("x{1}" ))
44
44
45
45
def test_int_set_get (self ):
46
- self .con .execute_command ('AI.SCRIPTRUN ' , 'redis_scripts{1}' , 'test_int_set_get' , 'OUTPUTS' , 'y{1}' )
46
+ self .con .execute_command ('AI.SCRIPTEXECUTE ' , 'redis_scripts{1}' , 'test_int_set_get' , 'KEYS' , 1 , "x{1}" , ' OUTPUTS', 1 , 'y{1}' )
47
47
y = self .con .execute_command ('AI.TENSORGET' , 'y{1}' , 'meta' ,'VALUES' )
48
48
self .env .assertEqual (y , [b"dtype" , b"INT64" , b"shape" , [], b"values" , [1 ]] )
49
49
50
50
def test_int_set_incr (self ):
51
- self .con .execute_command ('AI.SCRIPTRUN ' , 'redis_scripts{1}' , 'test_int_set_incr' , 'OUTPUTS' , 'y{1}' )
51
+ self .con .execute_command ('AI.SCRIPTEXECUTE ' , 'redis_scripts{1}' , 'test_int_set_incr' , 'KEYS' , 1 , "x{1}" , ' OUTPUTS', 1 , 'y{1}' )
52
52
y = self .con .execute_command ('AI.TENSORGET' , 'y{1}' , 'meta' ,'VALUES' )
53
53
self .env .assertEqual (y , [b"dtype" , b"INT64" , b"shape" , [], b"values" , [2 ]] )
54
54
55
55
def test_float_get_set (self ):
56
- self .con .execute_command ('AI.SCRIPTRUN ' , 'redis_scripts{1}' , 'test_float_set_get' , 'OUTPUTS' , 'y{1}' )
56
+ self .con .execute_command ('AI.SCRIPTEXECUTE ' , 'redis_scripts{1}' , 'test_float_set_get' , 'KEYS' , 1 , "x{1}" , ' OUTPUTS', 1 , 'y{1}' )
57
57
y = self .con .execute_command ('AI.TENSORGET' , 'y{1}' , 'meta' ,'VALUES' )
58
58
self .env .assertEqual (y [0 ], b"dtype" )
59
59
self .env .assertEqual (y [1 ], b"FLOAT" )
60
60
self .env .assertEqual (y [2 ], b"shape" )
61
61
self .env .assertEqual (y [3 ], [])
62
62
self .env .assertEqual (y [4 ], b"values" )
63
63
self .env .assertAlmostEqual (float (y [5 ][0 ]), 1.1 , 0.1 )
64
-
64
+
65
65
def test_int_list (self ):
66
- self .con .execute_command ('AI.SCRIPTRUN ' , 'redis_scripts{1}' , 'test_int_list' , 'OUTPUTS' , 'y{1}' )
66
+ self .con .execute_command ('AI.SCRIPTEXECUTE ' , 'redis_scripts{1}' , 'test_int_list' , 'KEYS' , 1 , "x{1}" , ' OUTPUTS', 1 , 'y{1}' )
67
67
y = self .con .execute_command ('AI.TENSORGET' , 'y{1}' , 'meta' ,'VALUES' )
68
68
self .env .assertEqual (y , [b"dtype" , b"INT64" , b"shape" , [2 , 1 ], b"values" , [1 , 2 ]] )
69
69
70
70
def test_hash (self ):
71
- self .con .execute_command ('AI.SCRIPTRUN ' , 'redis_scripts{1}' , 'test_hash' , 'OUTPUTS' , 'y{1}' )
71
+ self .con .execute_command ('AI.SCRIPTEXECUTE ' , 'redis_scripts{1}' , 'test_hash' , 'KEYS' , 1 , "x{1}" , ' OUTPUTS', 1 , 'y{1}' )
72
72
y = self .con .execute_command ('AI.TENSORGET' , 'y{1}' , 'meta' ,'VALUES' )
73
73
self .env .assertEqual (y , [b"dtype" , b"INT64" , b"shape" , [2 , 1 ], b"values" , [1 , 2 ]] )
0 commit comments