示例#1
0
 def test_in_expresions_with_list_are_allowed(self):
     visitor = ResourceNodeVisitor()
     node = ast.parse("package.name in ['foo', 'bar']")
     visitor.visit(node)
示例#2
0
 def test_comparisons_are_allowed(self):
     visitor = ResourceNodeVisitor()
     node = ast.parse("package.name == 'foo'")
     visitor.visit(node)
示例#3
0
 def test_in_expresions_are_allowed(self):
     visitor = ResourceNodeVisitor()
     node = ast.parse("'foo' in package.name")
     visitor.visit(node)
示例#4
0
 def test_calling_len_is_allowed(self):
     visitor = ResourceNodeVisitor()
     node = ast.parse("int('10')")
     visitor.visit(node)
示例#5
0
 def test_boolean_ops_are_allowed(self):
     visitor = ResourceNodeVisitor()
     node = ast.parse("package.name and package.version")
     visitor.visit(node)
示例#6
0
 def test_names_seen(self):
     visitor = ResourceNodeVisitor()
     node = ast.parse("package.name == 'fwts' and package.version == '1.2'")
     visitor.visit(node)
     self.assertEqual(visitor.names_seen, {'package'})
示例#7
0
 def test_calling_int_is_allowed(self):
     visitor = ResourceNodeVisitor()
     node = ast.parse("len(a)")
     visitor.visit(node)
示例#8
0
 def test_in_expresions_are_allowed(self):
     visitor = ResourceNodeVisitor()
     node = ast.parse("'foo' in package.name")
     visitor.visit(node)
示例#9
0
 def test_in_expresions_with_list_are_allowed(self):
     visitor = ResourceNodeVisitor()
     node = ast.parse("package.name in ['foo', 'bar']")
     visitor.visit(node)
示例#10
0
 def test_comparisons_are_allowed(self):
     visitor = ResourceNodeVisitor()
     node = ast.parse("package.name == 'foo'")
     visitor.visit(node)
示例#11
0
 def test_boolean_ops_are_allowed(self):
     visitor = ResourceNodeVisitor()
     node = ast.parse("package.name and package.version")
     visitor.visit(node)
示例#12
0
 def test_calling_len_is_allowed(self):
     visitor = ResourceNodeVisitor()
     node = ast.parse("int('10')")
     visitor.visit(node)
示例#13
0
 def test_calling_int_is_allowed(self):
     visitor = ResourceNodeVisitor()
     node = ast.parse("len(a)")
     visitor.visit(node)
示例#14
0
 def test_names_seen(self):
     visitor = ResourceNodeVisitor()
     node = ast.parse("package.name == 'fwts' and package.version == '1.2'")
     visitor.visit(node)
     self.assertEqual(visitor.names_seen, {'package'})