mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-12 02:21:29 +08:00
Merge pull request #1031 from rihkddd/master
fix: comparator contained_by should assert the type of expect_vaule.
This commit is contained in:
@@ -92,7 +92,7 @@ def contains(check_value: Any, expect_value: Any, message: Text = ""):
|
||||
|
||||
def contained_by(check_value: Any, expect_value: Any, message: Text = ""):
|
||||
assert isinstance(
|
||||
check_value, (list, tuple, dict, str, bytes)
|
||||
expect_value, (list, tuple, dict, str, bytes)
|
||||
), "expect_value should be list/tuple/dict/str/bytes type"
|
||||
assert check_value in expect_value, message
|
||||
|
||||
|
||||
@@ -49,6 +49,7 @@ class TestUtils(unittest.TestCase):
|
||||
functions_mapping["contains"](["1", "2"], "1")
|
||||
functions_mapping["contains"]({"a": 1, "b": 2}, "a")
|
||||
functions_mapping["contained_by"]("3ab", "123abc456")
|
||||
functions_mapping["contained_by"](0, [0, 200])
|
||||
|
||||
functions_mapping["regex_match"]("123abc456", "^123\w+456$")
|
||||
with self.assertRaises(AssertionError):
|
||||
|
||||
Reference in New Issue
Block a user