tests/data/cases/if_guard_inside_case.py
raw| 1 | # flags: --preview |
| 2 | |
| 3 | def f(x): |
| 4 | match x: |
| 5 | # good refactor |
| 6 | case [ |
| 7 | y |
| 8 | ] if y == 123: |
| 9 | pass |
| 10 | |
| 11 | case [ |
| 12 | y |
| 13 | ] if True: |
| 14 | pass |
| 15 | |
| 16 | case [ |
| 17 | y, |
| 18 | ] if True: |
| 19 | pass |
| 20 | |
| 21 | # bad refactor |
| 22 | case [ |
| 23 | y, |
| 24 | ] if y == 123: |
| 25 | pass |
| 26 | |
| 27 | |
| 28 | # output |
| 29 | |
| 30 | |
| 31 | def f(x): |
| 32 | match x: |
| 33 | # good refactor |
| 34 | case [y] if y == 123: |
| 35 | pass |
| 36 | |
| 37 | case [y] if True: |
| 38 | pass |
| 39 | |
| 40 | case [ |
| 41 | y, |
| 42 | ] if True: |
| 43 | pass |
| 44 | |
| 45 | # bad refactor |
| 46 | case [ |
| 47 | y, |
| 48 | ] if y == 123: |
| 49 | pass |