()
| 634 | |
| 635 | #[test] |
| 636 | fn test_parse_invalid_fstring() { |
| 637 | use InterpolatedStringErrorType::{InvalidConversionFlag, LambdaWithoutParentheses}; |
| 638 | |
| 639 | assert_eq!(parse_fstring_error(r#"f"{5!x}""#), InvalidConversionFlag); |
| 640 | assert_eq!( |
| 641 | parse_fstring_error("f'{lambda x:{x}}'"), |
| 642 | LambdaWithoutParentheses |
| 643 | ); |
| 644 | // NOTE: The parser produces the `LambdaWithoutParentheses` for this case, but |
| 645 | // since the parser only return the first error to maintain compatibility with |
| 646 | // the rest of the codebase, this test case fails. The `LambdaWithoutParentheses` |
| 647 | // error appears after the unexpected `FStringMiddle` token, which is between the |
| 648 | // `:` and the `{`. |
| 649 | // assert_eq!(parse_fstring_error("f'{lambda x: {x}}'"), LambdaWithoutParentheses); |
| 650 | assert!(parse_suite(r#"f"{class}""#).is_err()); |
| 651 | } |
| 652 | |
| 653 | #[test] |
| 654 | fn test_parse_fstring_not_equals() { |
nothing calls this directly
no outgoing calls
no test coverage detected