diff --git a/ate/utils.py b/ate/utils.py index b72cafaf..50a93ad6 100644 --- a/ate/utils.py +++ b/ate/utils.py @@ -210,6 +210,8 @@ def match_expected(value, expected, comparator="eq"): assert value in expected elif comparator in ["regex"]: assert re.match(expected, value) + else: + raise ParamsError("comparator not supported!") return True except AssertionError: diff --git a/test/test_utils.py b/test/test_utils.py index 3a191e08..86aacec3 100644 --- a/test/test_utils.py +++ b/test/test_utils.py @@ -197,4 +197,7 @@ class TestUtils(ApiServerUnittest): self.assertTrue(utils.match_expected("3ab", "123abc456", "contained_by")) self.assertTrue(utils.match_expected("123abc456", "^123.*456$", "regex")) - self.assertFalse(utils.match_expected("123abc456", "^12b.*456$", "regex")) \ No newline at end of file + self.assertFalse(utils.match_expected("123abc456", "^12b.*456$", "regex")) + + with self.assertRaises(exception.ParamsError): + utils.match_expected(1, 2, "not_supported_comparator")