self.assertEqual(f'{"#"}', '#')
self.assertEqual(f'{d["#"]}', 'hash')
- self.assertAllRaise(SyntaxError, "f-string cannot include '#'",
+ self.assertAllRaise(SyntaxError, "f-string expression part cannot include '#'",
["f'{1#}'", # error because the expression becomes "(1#)"
"f'{3(#)}'",
+ "f'{#}'",
])
def test_many_expressions(self):
} else if (ch == '#') {
/* Error: can't include a comment character, inside parens
or not. */
- ast_error(c, n, "f-string cannot include '#'");
+ ast_error(c, n, "f-string expression part cannot include '#'");
return -1;
} else if (nested_depth == 0 &&
(ch == '!' || ch == ':' || ch == '}')) {