Add helpers to TestPipResult

上级 50247de9
......@@ -353,6 +353,27 @@ class TestPipResult(object):
.format(**locals())
)
def did_create(self, path, message=None):
assert str(path) in self.files_created, _one_or_both(message, self)
def did_not_create(self, path, message=None):
assert str(path) not in self.files_created, _one_or_both(message, self)
def did_update(self, path, message=None):
assert str(path) in self.files_updated, _one_or_both(message, self)
def did_not_update(self, path, message=None):
assert str(path) not in self.files_updated, _one_or_both(message, self)
def _one_or_both(a, b):
"""Returns f"{a}\n{b}" if a is truthy, else returns str(b).
"""
if not a:
return str(b)
return "{a}\n{b}".format(a=a, b=b)
def make_check_stderr_message(stderr, line, reason):
"""
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册