test_dis.py 文件源码

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

项目:python-xdis 作者: rocky 项目源码 文件源码
def test_big_linenos(self):
        def func(count):
            namespace = {}
            func = "def foo():\n " + "".join(["\n "] * count + ["spam\n"])
            six.exec_(func, namespace)
            return namespace['foo']

        # Test all small ranges
        big_lineno_format = _BIG_LINENO_FORMAT_36 if PY36 else _BIG_LINENO_FORMAT
        for i in range(1, 300):
            expected = big_lineno_format % (i + 2)
            self.do_disassembly(func(i), expected)

        # Test some larger ranges too
        for i in range(300, 5000, 10):
            expected = big_lineno_format % (i + 2)
            self.do_disassembly(func(i), expected)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号