Lines Matching defs:expr
279 if isinstance(ast_node, (ast.expr, ast.stmt, ast.excepthandler)):
430 self.assertTrue(issubclass(ast.Name, ast.expr))
432 self.assertTrue(issubclass(ast.expr, ast.AST))
675 m = ast.Module([ast.Expr(ast.expr(**pos), **pos)], [])
678 self.assertIn("but got <ast.expr", str(cm.exception))
751 self.assertEqual(ast.withitem.__doc__, "withitem(expr context_expr, expr? optional_vars)")
755 expressions = [f" | {node.__doc__}" for node in ast.expr.__subclasses__()]
756 expressions[0] = f"expr = {ast.expr.__subclasses__()[0].__doc__}"
757 self.assertCountEqual(ast.expr.__doc__.split("\n"), expressions)
803 expr = ast.Expression(ast.Name(constant, ast.Load()))
804 ast.fix_missing_locations(expr)
806 compile(expr, "<test>", "eval")
1289 def expr(self, node, msg=None, *, exc=ValueError):
1511 self.expr(b, "less than 2 values")
1513 self.expr(b, "less than 2 values")
1515 self.expr(b, "None disallowed")
1517 self.expr(b, "must have Load context")
1521 self.expr(u, "must have Load context")
1525 self.expr(ast.Lambda(a, ast.Name("x", ast.Store())),
1529 self._check_arguments(fac, self.expr)
1535 self.expr(ast.IfExp(*args), "must have Load context")
1539 self.expr(d, "same number of keys as values")
1541 self.expr(d, "None disallowed")
1544 self.expr(ast.Set([None]), "None disallowed")
1546 self.expr(s, "must have Load context")
1549 self.expr(fac([]), "comprehension with no generators")
1552 self.expr(fac([g]), "must have Store context")
1555 self.expr(fac([g]), "must have Load context")
1559 self.expr(fac([g]), "None disallowed")
1561 self.expr(fac([g]), "must have Load context")
1566 self.expr(fac(ast.Name("x", ast.Store()), [g]),
1586 self.expr(c, "must have Load context")
1589 self.expr(c, "must have Load context")
1597 self.expr(ast.Yield(ast.Name("x", ast.Store())), "must have Load")
1598 self.expr(ast.YieldFrom(ast.Name("x", ast.Store())), "must have Load")
1603 self.expr(comp, "no comparators")
1605 self.expr(comp, "different number of comparators and operands")
1607 self.expr(comp)
1609 self.expr(comp)
1616 self.expr(call, "must have Load context")
1618 self.expr(call, "None disallowed")
1621 self.expr(call, "must have Load context")
1631 self.expr(ast.Num(obj))
1633 self.expr(ast.Num(obj), "invalid type", exc=TypeError)
1637 self.expr(attr, "must have Load context")
1642 self.expr(sub, "must have Load context")
1646 self.expr(sub, "must have Load context")
1650 self.expr(ast.Subscript(x, sl, ast.Load()),
1653 self.expr(ast.Subscript(x, sl, ast.Load()))
1655 self.expr(ast.Subscript(x, sl, ast.Load()), "must have Load context")
1664 self.expr(fac([None], ast.Load()), "None disallowed")
1665 self.expr(fac([ast.Name("x", ast.Store())], ast.Load()),
1675 self.expr(ast.NameConstant(4))