Skip to content

Commit dcf34bb

Browse files
committed
Allow qualname in literals
Qualnames should be usable in literals as well. E.g., a concrete Enum type.
1 parent fa3ff1e commit dcf34bb

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

src/docstub/doctype.lark

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ literals : "{" literal ("," literal)* "}"
5959
literal : PY_ELLIPSES
6060
| STRING
6161
| NUMBER
62-
| NAME
62+
| qualname
6363

6464
PY_ELLIPSES : "..."
6565

tests/test_docstrings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ def test_container(self, doctype, expected):
6363
[
6464
("{'a', 1, None, False}", "Literal['a', 1, None, False]"),
6565
("dict[{'a', 'b'}, int]", "dict[Literal['a', 'b'], int]"),
66+
("{SomeEnum.FIRST}", "Literal[SomeEnum_FIRST]"),
6667
],
6768
)
6869
def test_literals(self, doctype, expected):

0 commit comments

Comments
 (0)