Skip to content

Commit 000a199

Browse files
committed
Enabled macOS in CircleCI + Fixed basic_tests.py for decoding
1 parent d0726ce commit 000a199

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

.circleci/config.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,10 @@ workflows:
128128
filters:
129129
tags:
130130
only: /.*/
131-
# - build-macos:
132-
# filters:
133-
# tags:
134-
# only: /.*/
131+
- build-macos:
132+
filters:
133+
tags:
134+
only: /.*/
135135
- build-multiarch-docker:
136136
filters:
137137
tags:

test/basic_tests.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,15 @@ def example_multiproc_fn(env):
4444
def test_example_multiproc(env):
4545
run_test_multiproc(env, 10, lambda x: x.execute_command('set', 'x', 1))
4646
r = env.cmd('get', 'x')
47-
env.assertEqual(r, b'1')
47+
env.assertEqual(r, '1')
4848

4949

5050
def test_set_tensor(env):
5151
con = env
5252
con.execute_command('AI.TENSORSET', 'x', 'FLOAT', 2, 'VALUES', 2, 3)
5353
tensor = con.execute_command('AI.TENSORGET', 'x', 'VALUES')
5454
values = tensor[-1]
55-
env.assertEqual(values, [b'2', b'3'])
55+
env.assertEqual(values, ['2', '3'])
5656
con.execute_command('AI.TENSORSET', 'x', 'INT32', 2, 'VALUES', 2, 3)
5757
tensor = con.execute_command('AI.TENSORGET', 'x', 'VALUES')
5858
values = tensor[-1]
@@ -109,7 +109,7 @@ def test_del_tf_model(env):
109109

110110
ret = con.execute_command('AI.MODELSET', 'm', 'TF', 'CPU',
111111
'INPUTS', 'a', 'b', 'OUTPUTS', 'mul', model_pb)
112-
con.assertEqual(ret, b'OK')
112+
con.assertEqual(ret, 'OK')
113113

114114
con.execute_command('AI.MODELDEL', 'm')
115115
con.assertFalse(con.execute_command('EXISTS', 'm'))
@@ -130,7 +130,7 @@ def test_run_tf_model(env):
130130

131131
ret = con.execute_command('AI.MODELSET', 'm', 'TF', 'CPU',
132132
'INPUTS', 'a', 'b', 'OUTPUTS', 'mul', model_pb)
133-
con.assertEqual(ret, b'OK')
133+
con.assertEqual(ret, 'OK')
134134

135135
try:
136136
ret = con.execute_command('AI.MODELSET', 'm', 'TF', 'CPU',
@@ -227,7 +227,7 @@ def test_run_tf_model(env):
227227

228228
tensor = con.execute_command('AI.TENSORGET', 'c', 'VALUES')
229229
values = tensor[-1]
230-
con.assertEqual(values, [b'4', b'9', b'4', b'9'])
230+
con.assertEqual(values, ['4', '9', '4', '9'])
231231

232232
for _ in con.reloadingIterator():
233233
env.assertExists('m')
@@ -250,7 +250,7 @@ def test_run_torch_model(env):
250250
con = env
251251

252252
ret = con.execute_command('AI.MODELSET', 'm', 'TORCH', 'CPU', model_pb)
253-
con.assertEqual(ret, b'OK')
253+
con.assertEqual(ret, 'OK')
254254

255255
try:
256256
con.execute_command('AI.MODELSET', 'm', 'TORCH', 'CPU', wrong_model_pb)
@@ -325,7 +325,7 @@ def test_run_torch_model(env):
325325

326326
tensor = con.execute_command('AI.TENSORGET', 'c', 'VALUES')
327327
values = tensor[-1]
328-
con.assertEqual(values, [b'4', b'6', b'4', b'6'])
328+
con.assertEqual(values, ['4', '6', '4', '6'])
329329

330330
for _ in con.reloadingIterator():
331331
env.assertExists('m')
@@ -352,7 +352,7 @@ def test_run_onnx_model(env):
352352
con = env
353353

354354
ret = con.execute_command('AI.MODELSET', 'm', 'ONNX', 'CPU', model_pb)
355-
con.assertEqual(ret, b'OK')
355+
con.assertEqual(ret, 'OK')
356356

357357
try:
358358
con.execute_command('AI.MODELSET', 'm', 'ONNX', 'CPU', wrong_model_pb)
@@ -450,11 +450,11 @@ def test_run_onnxml_model(env):
450450
con = env
451451

452452
ret = con.execute_command('AI.MODELSET', 'linear', 'ONNX', 'CPU', linear_model)
453-
con.assertEqual(ret, b'OK')
453+
con.assertEqual(ret, 'OK')
454454

455455
con = env
456456
ret = con.execute_command('AI.MODELSET', 'logreg', 'ONNX', 'CPU', logreg_model)
457-
con.assertEqual(ret, b'OK')
457+
con.assertEqual(ret, 'OK')
458458

459459
con.execute_command('AI.TENSORSET', 'features', 'FLOAT', 1, 4, 'VALUES', 5.1, 3.5, 1.4, 0.2)
460460

@@ -479,7 +479,7 @@ def test_set_tensor_multiproc(env):
479479
con = env
480480
tensor = con.execute_command('AI.TENSORGET', 'x', 'VALUES')
481481
values = tensor[-1]
482-
env.assertEqual(values, [b'2', b'3'])
482+
env.assertEqual(values, ['2', '3'])
483483

484484

485485
def load_mobilenet_test_data():
@@ -522,7 +522,7 @@ def test_run_mobilenet(env):
522522

523523
dtype, shape, data = con.execute_command('AI.TENSORGET', 'output', 'BLOB')
524524

525-
dtype_map = {b'FLOAT': np.float32}
525+
dtype_map = {'FLOAT': np.float32}
526526
tensor = np.frombuffer(data, dtype=dtype_map[dtype]).reshape(shape)
527527
label_id = np.argmax(tensor) - 1
528528

@@ -557,7 +557,7 @@ def test_run_mobilenet_multiproc(env):
557557

558558
dtype, shape, data = con.execute_command('AI.TENSORGET', 'output', 'BLOB')
559559

560-
dtype_map = {b'FLOAT': np.float32}
560+
dtype_map = {'FLOAT': np.float32}
561561
tensor = np.frombuffer(data, dtype=dtype_map[dtype]).reshape(shape)
562562
label_id = np.argmax(tensor) - 1
563563

@@ -609,7 +609,7 @@ def test_del_script(env):
609609
script = f.read()
610610

611611
ret = env.execute_command('AI.SCRIPTSET', 'ket', 'CPU', script)
612-
env.assertEqual(ret, b'OK')
612+
env.assertEqual(ret, 'OK')
613613

614614
ret = env.execute_command('AI.SCRIPTDEL', 'ket')
615615
env.assertFalse(env.execute_command('EXISTS', 'ket'))
@@ -655,7 +655,7 @@ def test_run_script(env):
655655

656656
tensor = env.execute_command('AI.TENSORGET', 'c', 'VALUES')
657657
values = tensor[-1]
658-
env.assertEqual(values, [b'4', b'6', b'4', b'6'])
658+
env.assertEqual(values, ['4', '6', '4', '6'])
659659

660660
for _ in env.reloadingIterator():
661661
env.assertExists('ket')

0 commit comments

Comments
 (0)