test_translator.py 文件源码

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

项目:py_gpumap 作者: ipachev 项目源码 文件源码
def test_slice(self):
        node = ast.parse("some_list[0:5]")
        self.assertRaises(SyntaxError, self.fc.visit, node)

        node = ast.parse("some_list[i:i+5]")
        self.assertRaises(SyntaxError, self.fc.visit, node)

        node = ast.parse("some_list[i + j : i + j + 5]")
        self.assertRaises(SyntaxError, self.fc.visit, node)

        node = ast.parse("some_list[func1() : func2()]")
        self.assertRaises(SyntaxError, self.fc.visit, node)

        node = ast.parse("some_list[func(i) : func(j)]")
        self.assertRaises(SyntaxError, self.fc.visit, node)

        node = ast.parse("some_list[x.some_method(i) : x.some_method(j)]")
        self.assertRaises(SyntaxError, self.fc.visit, node)

        node = ast.parse("get_list()[1:5]")
        self.assertRaises(SyntaxError, self.fc.visit, node)

        node = ast.parse("x.get_list()[x.some_method(i): x.some_method(j)]")
        self.assertRaises(SyntaxError, self.fc.visit, node)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号