aboutsummaryrefslogtreecommitdiff
path: root/ethosu/mlw_codec/test
diff options
context:
space:
mode:
authorLouis Verhaard <louis.verhaard@arm.com>2021-01-22 14:11:15 +0100
committerLouis Verhaard <louis.verhaard@arm.com>2021-01-28 08:36:03 +0100
commit60232140a2927865d1f6f9bc48871df3b2bb135b (patch)
tree69f88870c51212ed2cfe53aa40b419fa773281a7 /ethosu/mlw_codec/test
parentb21837638cf6cb015f2a1deb1bb81176e620a306 (diff)
downloadethos-u-vela-60232140a2927865d1f6f9bc48871df3b2bb135b.tar.gz
MLBEDSW-3832: mlw_codec: improve C API
- Removed unnecessary casts - Added more error handling Signed-off-by: Louis Verhaard <louis.verhaard@arm.com> Change-Id: I30cc37a2fb1e855b9f67599c280c1f383f0b059e
Diffstat (limited to 'ethosu/mlw_codec/test')
-rw-r--r--ethosu/mlw_codec/test/test_mlw_codec.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/ethosu/mlw_codec/test/test_mlw_codec.py b/ethosu/mlw_codec/test/test_mlw_codec.py
index d37462d1..18c828a3 100644
--- a/ethosu/mlw_codec/test/test_mlw_codec.py
+++ b/ethosu/mlw_codec/test/test_mlw_codec.py
@@ -60,3 +60,17 @@ class TestMLWCodec:
def _call_mlw_codec_method(self, method_name, test_input, expected):
output = method_name(test_input)
assert output == expected
+
+ invalid_encode_test_data = [None, 3, [4, 5, None, 7], [0, 1, "two", 3], [1, 2, 256, 4], [2, 4, 8, -256]]
+
+ @pytest.mark.parametrize("input", invalid_encode_test_data)
+ def test_encode_invalid_input(self, input):
+ with pytest.raises(Exception):
+ mlw_codec.encode(input)
+
+ invalid_decode_test_data = [None, 3, []]
+
+ @pytest.mark.parametrize("input", invalid_decode_test_data)
+ def test_decode_invalid_input(self, input):
+ with pytest.raises(Exception):
+ mlw_codec.decode(input)