mox.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:pymox 作者: ivancrneto 项目源码 文件源码
def __init__(self, unexpected_method, expected):
        """Init exception.

        Args:
          # unexpected_method: MockMethod that was called but was not at the
          #   head of the expected_method queue.
          # expected: MockMethod or UnorderedGroup the method should have
          #   been in.
          unexpected_method: MockMethod
          expected: MockMethod or UnorderedGroup
        """

        Error.__init__(self)
        if expected is None:
            self._str = "Unexpected method call %s" % (unexpected_method,)
        else:
            differ = difflib.Differ()
            diff = differ.compare(str(unexpected_method).splitlines(True),
                                  str(expected).splitlines(True))
            self._str = (
                "Unexpected method call.  unexpected:-  expected:+\n%s"
                % ("\n".join(line.rstrip() for line in diff),)
            )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号