bugfix: comparison with None should raise exception in Python 2.7

This commit is contained in:
httprunner
2017-08-02 16:44:51 +08:00
parent dd488bd48e
commit 393fea8d84
2 changed files with 6 additions and 1 deletions

View File

@@ -152,6 +152,11 @@ def match_expected(value, expected, comparator="eq", check_item=""):
@param check_item: check item name
"""
try:
if value is None or expected is None:
assert comparator in ["is", "eq", "equals", "=="]
assert value is None
assert expected is None
if comparator in ["eq", "equals", "=="]:
assert value == expected
elif comparator in ["str_eq", "string_equals"]: