match_expected: add comparator str_len/string_length

This commit is contained in:
debugtalk
2017-06-29 17:32:49 +08:00
parent c9de871485
commit abcba302ae
2 changed files with 5 additions and 0 deletions

View File

@@ -210,6 +210,8 @@ def match_expected(value, expected, comparator="eq"):
assert value in expected
elif comparator in ["regex"]:
assert re.match(expected, value)
elif comparator in ["str_len", "string_length"]:
assert len(value) == int(expected)
else:
raise ParamsError("comparator not supported!")