| 3442 | |
| 3443 | #[test] |
| 3444 | fn test_parse_assignment() { |
| 3445 | for test_case in &[ |
| 3446 | "a = 1", |
| 3447 | "a = None", |
| 3448 | "a = True", |
| 3449 | "a = False", |
| 3450 | "a = 1j", |
| 3451 | "a = b'1'", |
| 3452 | "a = rb'1'", |
| 3453 | "a = br'1'", |
| 3454 | "a = \"a\"", |
| 3455 | "a = '''a'''", |
| 3456 | "a = \"\"\"a\"\"\"", |
| 3457 | "a = 'a'", |
| 3458 | "a = 1, 2", |
| 3459 | "a = 1, 2, ", |
| 3460 | "a = b = 1", |
| 3461 | "a,b = c,d = 1,2", |
| 3462 | // augmented assignment |
| 3463 | "a += 1", |
| 3464 | "a -= 1", |
| 3465 | "a *= 1", |
| 3466 | "a /= 1", |
| 3467 | "a //= 1", |
| 3468 | "a %= 1", |
| 3469 | "a **= 1", |
| 3470 | "a <<= 1", |
| 3471 | "a >>= 1", |
| 3472 | "a &= 1", |
| 3473 | "a ^= 1", |
| 3474 | "a |= 1", |
| 3475 | // annotated assignment |
| 3476 | ] { |
| 3477 | let mut parser = Parser::new(test_case); |
| 3478 | let program = parser.parse().expect("parsing failed"); |
| 3479 | |
| 3480 | insta::with_settings!({ |
| 3481 | description => test_case.to_string(), // the template source code |
| 3482 | snapshot_path => "../../test_data/output/", |
| 3483 | omit_expression => true // do not include the default expression |
| 3484 | }, { |
| 3485 | assert_debug_snapshot!(program); |
| 3486 | }); |
| 3487 | } |
| 3488 | } |
| 3489 | |
| 3490 | #[test] |
| 3491 | fn test_parse_assert_stmt() { |