Skip to content

Commit d74d953

Browse files
author
DvirDukhan
committed
fixed PR comments
1 parent 139f1dd commit d74d953

File tree

1 file changed

+19
-19
lines changed

1 file changed

+19
-19
lines changed

tests/flow/tests_common.py

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,16 @@ def test_common_tensorset(env):
1212

1313
tested_datatypes = ["FLOAT", "DOUBLE", "INT8", "INT16", "INT32", "INT64", "UINT8", "UINT16", "BOOL"]
1414
for datatype in tested_datatypes:
15-
ret = con.execute_command('AI.TENSORSET', 'tensor_{0}{{0}}'.format(datatype), datatype, 2, 'VALUES', 1, 1)
15+
ret = con.execute_command('AI.TENSORSET', 'tensor_{}{{0}}'.format(datatype), datatype, 2, 'VALUES', 1, 1)
1616
env.assertEqual(ret, b'OK')
1717

1818
ensureSlaveSynced(con, env)
1919

2020
# AI.TENSORGET in BLOB format and set in a new key
2121
for datatype in tested_datatypes:
22-
_, tensor_dtype, _, tensor_dim, _, tensor_blob = con.execute_command('AI.TENSORGET', 'tensor_{0}{{0}}'.format(datatype),
22+
_, tensor_dtype, _, tensor_dim, _, tensor_blob = con.execute_command('AI.TENSORGET', 'tensor_{}{{0}}'.format(datatype),
2323
'META', 'BLOB')
24-
ret = con.execute_command('AI.TENSORSET', 'tensor_blob_{0}{{0}}'.format(datatype), datatype, 2, 'BLOB', tensor_blob)
24+
ret = con.execute_command('AI.TENSORSET', 'tensor_blob_{}{{0}}'.format(datatype), datatype, 2, 'BLOB', tensor_blob)
2525
env.assertEqual(ret, b'OK')
2626

2727
ensureSlaveSynced(con, env)
@@ -30,8 +30,8 @@ def test_common_tensorset(env):
3030
# Confirm that tensor_{0} and tensor_blob_{0} are equal for META VALUES BLOB
3131
for datatype in tested_datatypes:
3232
for reply_type in reply_types:
33-
tensor_1_reply = con.execute_command('AI.TENSORGET', 'tensor_{0}{{0}}'.format(datatype), reply_type)
34-
tensor_2_reply = con.execute_command('AI.TENSORGET', 'tensor_blob_{0}{{0}}'.format(datatype), reply_type)
33+
tensor_1_reply = con.execute_command('AI.TENSORGET', 'tensor_{}{{0}}'.format(datatype), reply_type)
34+
tensor_2_reply = con.execute_command('AI.TENSORGET', 'tensor_blob_{}{{0}}'.format(datatype), reply_type)
3535
env.assertEqual(tensor_1_reply, tensor_2_reply)
3636

3737

@@ -186,15 +186,15 @@ def test_common_tensorget(env):
186186
tested_datatypes_fp = ["FLOAT", "DOUBLE"]
187187
tested_datatypes_int = ["INT8", "INT16", "INT32", "INT64", "UINT8", "UINT16", "BOOL"]
188188
for datatype in tested_datatypes:
189-
ret = con.execute_command('AI.TENSORSET', 'tensor_{0}{{0}}'.format(datatype), datatype, 2, 'VALUES', 1, 1)
189+
ret = con.execute_command('AI.TENSORSET', 'tensor_{}{{0}}'.format(datatype), datatype, 2, 'VALUES', 1, 1)
190190
env.assertEqual(ret, b'OK')
191191

192192
ensureSlaveSynced(con, env)
193193

194194
# AI.TENSORGET in BLOB format and set in a new key
195195
for datatype in tested_datatypes:
196-
tensor_blob = con.execute_command('AI.TENSORGET', 'tensor_{0}{{0}}'.format(datatype), 'BLOB')
197-
ret = con.execute_command('AI.TENSORSET', 'tensor_blob_{0}{{0}}'.format(datatype), datatype, 2, 'BLOB', tensor_blob)
196+
tensor_blob = con.execute_command('AI.TENSORGET', 'tensor_{}{{0}}'.format(datatype), 'BLOB')
197+
ret = con.execute_command('AI.TENSORSET', 'tensor_blob_{}{{0}}'.format(datatype), datatype, 2, 'BLOB', tensor_blob)
198198
env.assertEqual(ret, b'OK')
199199

200200
ensureSlaveSynced(con, env)
@@ -203,19 +203,19 @@ def test_common_tensorget(env):
203203
# Confirm that tensor_{0} and tensor_blog_{0} are equal for META VALUES BLOB
204204
for datatype in tested_datatypes:
205205
for reply_type in reply_types:
206-
tensor_1_reply = con.execute_command('AI.TENSORGET', 'tensor_{0}{{0}}'.format(datatype), reply_type)
207-
tensor_2_reply = con.execute_command('AI.TENSORGET', 'tensor_blob_{0}{{0}}'.format(datatype), reply_type)
206+
tensor_1_reply = con.execute_command('AI.TENSORGET', 'tensor_{}{{0}}'.format(datatype), reply_type)
207+
tensor_2_reply = con.execute_command('AI.TENSORGET', 'tensor_blob_{}{{0}}'.format(datatype), reply_type)
208208
env.assertEqual(tensor_1_reply, tensor_2_reply)
209209

210210
# Confirm that the output is the expected for META
211211
for datatype in tested_datatypes:
212-
_, tensor_dtype, _, tensor_dim = con.execute_command('AI.TENSORGET', 'tensor_{0}{{0}}'.format(datatype), "META")
212+
_, tensor_dtype, _, tensor_dim = con.execute_command('AI.TENSORGET', 'tensor_{}{{0}}'.format(datatype), "META")
213213
env.assertEqual(datatype.encode('utf-8'), tensor_dtype)
214214
env.assertEqual([2], tensor_dim)
215215

216216
# Confirm that the output is the expected for VALUES
217217
for datatype in tested_datatypes:
218-
_, tensor_dtype, _, tensor_dim, _, tensor_values = con.execute_command('AI.TENSORGET', 'tensor_{0}{{0}}'.format(datatype),
218+
_, tensor_dtype, _, tensor_dim, _, tensor_values = con.execute_command('AI.TENSORGET', 'tensor_{}{{0}}'.format(datatype),
219219
'META', 'VALUES')
220220
env.assertEqual(datatype.encode('utf-8'), tensor_dtype)
221221
env.assertEqual([2], tensor_dim)
@@ -226,17 +226,17 @@ def test_common_tensorget(env):
226226

227227
# Confirm that the output is the expected for BLOB
228228
for datatype in tested_datatypes:
229-
_, tensor_dtype, _, tensor_dim, _, tensor_blob = con.execute_command('AI.TENSORGET', 'tensor_{0}{{0}}'.format(datatype),
229+
_, tensor_dtype, _, tensor_dim, _, tensor_blob = con.execute_command('AI.TENSORGET', 'tensor_{}{{0}}'.format(datatype),
230230
'META', 'BLOB')
231231
env.assertEqual(datatype.encode('utf-8'), tensor_dtype)
232232
env.assertEqual([2], tensor_dim)
233233

234234
# Confirm that default reply format is META BLOB
235235
for datatype in tested_datatypes:
236-
_, tensor_dtype, _, tensor_dim, _, tensor_blob = con.execute_command('AI.TENSORGET', 'tensor_{0}{{0}}'.format(datatype),
236+
_, tensor_dtype, _, tensor_dim, _, tensor_blob = con.execute_command('AI.TENSORGET', 'tensor_{}{{0}}'.format(datatype),
237237
'META', 'BLOB')
238238
_, tensor_dtype_default, _, tensor_dim_default, _, tensor_blob_default = con.execute_command('AI.TENSORGET',
239-
'tensor_{0}{{0}}'.format(datatype))
239+
'tensor_{}{{0}}'.format(datatype))
240240
env.assertEqual(tensor_dtype, tensor_dtype_default)
241241
env.assertEqual(tensor_dim, tensor_dim_default)
242242
env.assertEqual(tensor_blob, tensor_blob_default)
@@ -288,23 +288,23 @@ def test_common_tensorset_multiproc_blob(env):
288288
tested_datatypes = ["FLOAT", "DOUBLE", "INT8", "INT16", "INT32", "INT64", "UINT8", "UINT16"]
289289
tested_datatypes_map = {}
290290
for datatype in tested_datatypes:
291-
ret = con.execute_command('AI.TENSORSET', 'tensor_{0}{{0}}'.format(datatype), datatype, 1, 256)
291+
ret = con.execute_command('AI.TENSORSET', 'tensor_{}{{0}}'.format(datatype), datatype, 1, 256)
292292
env.assertEqual(ret, b'OK')
293293

294294
ensureSlaveSynced(con, env)
295295

296296
# AI.TENSORGET in BLOB format and set in a new key
297297
for datatype in tested_datatypes:
298-
tensor_blob = con.execute_command('AI.TENSORGET', 'tensor_{0}{{0}}'.format(datatype),
298+
tensor_blob = con.execute_command('AI.TENSORGET', 'tensor_{}{{0}}'.format(datatype),
299299
'BLOB')
300-
ret = con.execute_command('AI.TENSORSET', 'tensor_blob_{0}{{0}}'.format(datatype), datatype, 1, 256, 'BLOB', tensor_blob)
300+
ret = con.execute_command('AI.TENSORSET', 'tensor_blob_{}{{0}}'.format(datatype), datatype, 1, 256, 'BLOB', tensor_blob)
301301
tested_datatypes_map[datatype] = tensor_blob
302302
env.assertEqual(ret, b'OK')
303303

304304
def funcname(env, blob, repetitions, same_key):
305305
for _ in range(1,same_key):
306306
for repetion in range(1,repetitions):
307-
env.execute_command('AI.TENSORSET', 'tensor_{0}{{0}}'.format(repetitions), 'FLOAT', 1, 256, 'BLOB', blob)
307+
env.execute_command('AI.TENSORSET', 'tensor_{}{{0}}'.format(repetitions), 'FLOAT', 1, 256, 'BLOB', blob)
308308

309309
tensor_blob = tested_datatypes_map["FLOAT"]
310310
t = time.time()

0 commit comments

Comments
 (0)