mirror of
https://github.com/httprunner/httprunner.git
synced 2026-05-13 17:29:56 +08:00
fix #942: type_match None
This commit is contained in:
@@ -1,5 +1,11 @@
|
||||
# Release History
|
||||
|
||||
## 3.1.1 (2020-06-21)
|
||||
|
||||
**Fixed**
|
||||
|
||||
- fix #942: type_match None
|
||||
|
||||
## 3.1.0 (2020-06-21)
|
||||
|
||||
**Added**
|
||||
|
||||
@@ -48,6 +48,9 @@ teststeps:
|
||||
validate:
|
||||
- eq: ["status_code", 200]
|
||||
- eq: ["body.data", "This is expected to be sent back as part of response body: bar12-$expect_foo2-bar21."]
|
||||
- type_match: ["body.json", None]
|
||||
- type_match: ["body.json", NoneType]
|
||||
- type_match: ["body.json", null]
|
||||
-
|
||||
name: post form data
|
||||
variables:
|
||||
|
||||
@@ -57,6 +57,9 @@ class TestCaseRequestWithFunctions(HttpRunner):
|
||||
"body.data",
|
||||
"This is expected to be sent back as part of response body: bar12-$expect_foo2-bar21.",
|
||||
)
|
||||
.assert_type_match("body.json", "None")
|
||||
.assert_type_match("body.json", "NoneType")
|
||||
.assert_type_match("body.json", None)
|
||||
),
|
||||
Step(
|
||||
RunRequest("post form data")
|
||||
|
||||
@@ -80,7 +80,10 @@ def type_match(check_value, expect_value):
|
||||
else:
|
||||
raise ValueError(name)
|
||||
|
||||
assert isinstance(check_value, get_type(expect_value))
|
||||
if expect_value in ["None", "NoneType", None]:
|
||||
assert check_value is None
|
||||
else:
|
||||
assert type(check_value) == get_type(expect_value)
|
||||
|
||||
|
||||
def regex_match(check_value, expect_value):
|
||||
|
||||
@@ -69,6 +69,9 @@ class TestUtils(unittest.TestCase):
|
||||
functions_mapping["type_match"]([1], "list")
|
||||
functions_mapping["type_match"]({}, "dict")
|
||||
functions_mapping["type_match"]({"a": 1}, "dict")
|
||||
functions_mapping["type_match"](None, "None")
|
||||
functions_mapping["type_match"](None, "NoneType")
|
||||
functions_mapping["type_match"](None, None)
|
||||
|
||||
def test_lower_dict_keys(self):
|
||||
request_dict = {
|
||||
|
||||
Reference in New Issue
Block a user