Change FormattedString's end field to a Literal

I noticed this while working on the documentation. I think this predated
pyre's Literal support.

I only did this for `end` and not `start`, because there's a large
combinatorial set of valid `start` values. If we wanted to better type
`start`, we should probably first separate the prefix from the opening
quotes.
This commit is contained in:
Benjamin Woodruff 2019-08-06 16:34:19 -07:00 committed by Benjamin Woodruff
parent 647ef53f0e
commit ff9ed2e8e4
2 changed files with 1 additions and 7 deletions

View file

@ -763,7 +763,7 @@ class FormattedString(_BasePrefixedString):
start: str = 'f"'
#: The trailing quote. This must match the type of quote used in ``start``.
end: str = '"'
end: Literal['"', "'", '"""', "'''"] = '"'
lpar: Sequence[LeftParen] = ()
#: Sequence of parenthesis for precidence dictation.

View file

@ -839,12 +839,6 @@ class AtomTest(CSTNodeTest):
),
"expected_re": "must have matching enclosing quotes",
},
{
"get_node": (
lambda: cst.FormattedString(start="f'''", parts=(), end="''")
),
"expected_re": "must have matching enclosing quotes",
},
{
"get_node": (
lambda: cst.ConcatenatedString(