Replace asserts with exceptions in mbedtls_test.py
diff --git a/tests/scripts/mbedtls_test.py b/tests/scripts/mbedtls_test.py
index b825f13..52fd0a9 100755
--- a/tests/scripts/mbedtls_test.py
+++ b/tests/scripts/mbedtls_test.py
@@ -34,6 +34,11 @@
 from mbed_host_tests import BaseHostTest, event_callback
 
 
+class TestDataParserError(Exception):
+    """Indicates error in test data, read from .data file."""
+    pass
+
+
 class TestDataParser(object):
     """
     parser for mbedtls test data files.
@@ -107,7 +112,9 @@
             function = int(parts[0])
             x = parts[1:]
             l = len(x)
-            assert l % 2 == 0, "Number of test arguments should be even: %s" % line
+            if l % 2 != 0:
+                raise TestDataParserError("Number of test arguments should "
+                                          "be even: %s" % line)
             args = [(x[i * 2], x[(i * 2) + 1]) for i in range(len(x)/2)]
             self.tests.append((name, function, deps, args))
 
@@ -194,10 +201,13 @@
         :param hex_str: Hex in string format.
         :return: Output Byte array
         """
-        assert hex_str[0] == '"' and hex_str[len(hex_str) - 1] == '"', \
-            "HEX test parameter missing '\"': %s" % hex_str
+        if hex_str[0] != '"' or hex_str[len(hex_str) - 1] != '"':
+            raise TestDataParserError("HEX test parameter missing '\"':"
+                                      " %s" % hex_str)
         hex_str = hex_str.strip('"')
-        assert len(hex_str) % 2 == 0, "HEX parameter len should be mod of 2: %s" % hex_str
+        if len(hex_str) % 2 != 0:
+            raise TestDataParserError("HEX parameter len should be mod of "
+                                      "2: %s" % hex_str)
 
         b = binascii.unhexlify(hex_str)
         return b