(self)
| 498 | """), '<eval>', 'exec') |
| 499 | |
| 500 | def test_compile_invalid_namedexpr(self): |
| 501 | # gh-109351 |
| 502 | m = ast.Module( |
| 503 | body=[ |
| 504 | ast.Expr( |
| 505 | value=ast.ListComp( |
| 506 | elt=ast.NamedExpr( |
| 507 | target=ast.Constant(value=1), |
| 508 | value=ast.Constant(value=3), |
| 509 | ), |
| 510 | generators=[ |
| 511 | ast.comprehension( |
| 512 | target=ast.Name(id="x", ctx=ast.Store()), |
| 513 | iter=ast.Name(id="y", ctx=ast.Load()), |
| 514 | ifs=[], |
| 515 | is_async=0, |
| 516 | ) |
| 517 | ], |
| 518 | ) |
| 519 | ) |
| 520 | ], |
| 521 | type_ignores=[], |
| 522 | ) |
| 523 | |
| 524 | with self.assertRaisesRegex(TypeError, "NamedExpr target must be a Name"): |
| 525 | compile(ast.fix_missing_locations(m), "<file>", "exec") |
| 526 | |
| 527 | def test_compile_redundant_jumps_and_nops_after_moving_cold_blocks(self): |
| 528 | # See gh-120367 |
nothing calls this directly
no test coverage detected