def test_is(self):
# object comparison not yet supported
node = ast.parse("1 is 3")
self.assertRaises(SyntaxError, self.fc.visit, node)
node = ast.parse("1 is 3 is 4")
self.assertRaises(SyntaxError, self.fc.visit, node)
node = ast.parse("a is 1")
self.assertRaises(SyntaxError, self.fc.visit, node)
node = ast.parse("a is b is c")
self.assertRaises(SyntaxError, self.fc.visit, node)
node = ast.parse("a is x.some_method(b)")
self.assertRaises(SyntaxError, self.fc.visit, node)
node = ast.parse("x.some_method(a) is x.some_method(b)" +
" is x.some_method(c) is x.some_method(d)")
self.assertRaises(SyntaxError, self.fc.visit, node)
评论列表
文章目录