test_translator.py 文件源码

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

项目:py_gpumap 作者: ipachev 项目源码 文件源码
def test_is_not(self):
        # object comparison not yet supported
        node = ast.parse("1 is not 3")
        self.assertRaises(SyntaxError, self.fc.visit, node)

        node = ast.parse("1 is not 3 is not 4")
        self.assertRaises(SyntaxError, self.fc.visit, node)

        node = ast.parse("a is not 1")
        self.assertRaises(SyntaxError, self.fc.visit, node)

        node = ast.parse("a is not b is not c")
        self.assertRaises(SyntaxError, self.fc.visit, node)

        node = ast.parse("a is not x.some_method(b)")
        self.assertRaises(SyntaxError, self.fc.visit, node)

        node = ast.parse("x.some_method(a) is not x.some_method(b)" +
                         " is not x.some_method(c) is not x.some_method(d)")
        self.assertRaises(SyntaxError, self.fc.visit, node)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号