def test_in(self):
node = ast.parse("1 in [1, 2, 3]")
self.assertRaises(SyntaxError, self.fc.visit, node)
node = ast.parse("1 in (1, 2, 3)")
self.assertRaises(SyntaxError, self.fc.visit, node)
node = ast.parse("a in (1, 2, 3)")
self.assertRaises(SyntaxError, self.fc.visit, node)
node = ast.parse("a in some_list")
self.assertRaises(SyntaxError, self.fc.visit, node)
node = ast.parse("(a in some_list) in (True)")
self.assertRaises(SyntaxError, self.fc.visit, node)
node = ast.parse("x.some_method(a) in some_list")
self.assertRaises(SyntaxError, self.fc.visit, node)
node = ast.parse("x.some_method(a) in get_list()")
self.assertRaises(SyntaxError, self.fc.visit, node)
node = ast.parse("x.some_method(a) in x.get_list()")
self.assertRaises(SyntaxError, self.fc.visit, node)
评论列表
文章目录