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)
评论列表
文章目录