bug fix: 当使用.csv文件内容来做数据驱动测试时, length_xxx函数都会失败

This commit is contained in:
Long
2019-12-11 17:06:40 +08:00
parent 714f74cef5
commit b484c24a3e
2 changed files with 22 additions and 5 deletions

View File

@@ -80,6 +80,11 @@ class TestUtils(ApiServerUnittest):
functions_mapping["not_equals"](123, "123")
functions_mapping["length_equals"]("123", 3)
# Because the Numbers in a CSV file are by default treated as strings,
# you need to convert them to Numbers, and we'll test that out here.
functions_mapping["length_equals"]("123", '3')
with self.assertRaises(AssertionError):
functions_mapping["length_equals"]("123", 'abc')
functions_mapping["length_greater_than"]("123", 2)
functions_mapping["length_greater_than_or_equals"]("123", 3)