Skip to content

Commit c9eba52

Browse files
committed
PR fixes
1 parent 7564b42 commit c9eba52

File tree

1 file changed

+8
-23
lines changed

1 file changed

+8
-23
lines changed

tests/flow/tests_withGears.py

Lines changed: 8 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,6 @@ def wrapper(env, *args, **kwargs):
2828
return wrapper
2929

3030

31-
@skip_if_gears_not_loaded
32-
def test_ping_gears(env):
33-
34-
script = '''
35-
def ping(record):
36-
return "pong"
37-
38-
GB("CommandReader").map(ping).register(trigger="ping_test")
39-
'''
40-
con = env.getConnection()
41-
ret = con.execute_command('rg.pyexecute', script)
42-
env.assertEqual(ret, b'OK')
43-
ret = con.execute_command('rg.trigger', 'ping_test')
44-
env.assertEqual(ret[0], b'pong')
45-
46-
4731
@skip_if_gears_not_loaded
4832
def test_model_run(env):
4933
script = '''
@@ -56,7 +40,7 @@ def ModelRun_oldAPI(record):
5640
modelRunner = redisAI.createModelRunner('m{1}')
5741
redisAI.modelRunnerAddInput(modelRunner, 'a', tensors[0])
5842
redisAI.modelRunnerAddInput(modelRunner, 'b', tensors[1])
59-
redisAI.modelRunnerAddOutput(modelRunner, 'mul')
43+
redisAI.modelRunnerAddOutput(modelRunner, 'c')
6044
res = redisAI.modelRunnerRun(modelRunner)
6145
redisAI.setTensorInKey('c{1}', res[0])
6246
return "ModelRun_oldAPI_OK"
@@ -67,7 +51,7 @@ async def ModelRun_Async(record):
6751
modelRunner = redisAI.createModelRunner('m{1}')
6852
redisAI.modelRunnerAddInput(modelRunner, 'a', tensors[0])
6953
redisAI.modelRunnerAddInput(modelRunner, 'b', tensors[1])
70-
redisAI.modelRunnerAddOutput(modelRunner, 'mul')
54+
redisAI.modelRunnerAddOutput(modelRunner, 'c')
7155
res = await redisAI.modelRunnerRunAsync(modelRunner)
7256
redisAI.setTensorInKey('c{1}', res[0])
7357
return "ModelRun_Async_OK"
@@ -108,6 +92,8 @@ async def ModelRun_AsyncRunError(record):
10892
env.assertEqual(ret[0], b'ModelRun_oldAPI_OK')
10993
values = con.execute_command('AI.TENSORGET', 'c{1}', 'VALUES')
11094
env.assertEqual(values, [b'4', b'9', b'4', b'9'])
95+
ret = con.execute_command('DEL', 'c{1}')
96+
env.assertEqual(ret, 1)
11197

11298
ret = con.execute_command('rg.trigger', 'ModelRun_Async_test2')
11399
env.assertEqual(ret[0], b'ModelRun_Async_OK')
@@ -186,6 +172,8 @@ async def ScriptRun_AsyncRunError(record):
186172
env.assertEqual(ret[0], b'ScriptRun_oldAPI_OK')
187173
values = con.execute_command('AI.TENSORGET', 'c{1}', 'VALUES')
188174
env.assertEqual(values, [b'4', b'6', b'4', b'6'])
175+
ret = con.execute_command('DEL', 'c{1}')
176+
env.assertEqual(ret, 1)
189177

190178
ret = con.execute_command('rg.trigger', 'ScriptRun_Async_test2')
191179
env.assertEqual(ret[0], b'ScriptRun_Async_OK')
@@ -194,8 +182,7 @@ async def ScriptRun_AsyncRunError(record):
194182

195183
ret = con.execute_command('rg.trigger', 'ScriptRun_AsyncRunError_test3')
196184
# This should raise an exception
197-
error_string = b'attempted to get undefined function bad_func'
198-
env.assertEqual(str(ret[0])[:len(error_string)+2]+"'", "{}".format(error_string))
185+
env.assertTrue(str(ret[0]).startswith("b'attempted to get undefined function bad_func"))
199186

200187

201188
@skip_if_gears_not_loaded
@@ -314,9 +301,7 @@ async def DAGRun_addOpsFromString(record):
314301

315302
ret = con.execute_command('rg.trigger', 'DAGRun_test4')
316303
# This should raise an exception
317-
318-
error_string = b'attempted to get undefined function no_func'
319-
env.assertEqual(str(ret[0])[:len(error_string)+2]+"'", "{}".format(error_string))
304+
env.assertTrue(str(ret[0]).startswith("b'attempted to get undefined function no_func"))
320305

321306
ret = con.execute_command('rg.trigger', 'DAGRun_test5')
322307
env.assertEqual(ret[0], b'test5_OK')

0 commit comments

Comments
 (0)