test_dis.py 文件源码

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

项目:python-xdis 作者: rocky 项目源码 文件源码
def do_disassembly(self, func, expected):

        co = func.__code__
        bytecode = Bytecode(co, opc)
        got = bytecode.dis()

        # Trim trailing blanks (if any).
        lines = got.split('\n')
        lines = [line.rstrip() for line in lines]
        expected = expected.split("\n")
        import difflib
        if expected != lines:
            self.fail(
                "events did not match expectation:\n" +
                "\n".join(difflib.ndiff(expected,
                                        lines)))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号