8000 Add Literal support for docstrings by InvincibleRMC · Pull Request #17441 · python/mypy · GitHub
[go: up one dir, main page]

Skip to content

Add Literal support for docstrings #17441

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jun 29, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Add test
  • Loading branch information
InvincibleRMC committed Jun 25, 2024
commit 67a921f32e752ea9f4f304c0b7c3e4faf535e1a8
11 changes: 11 additions & 0 deletions mypy/test/teststubgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1357,6 +1357,17 @@ def test_is_valid_type(self) -> None:
assert is_valid_type("List[int]")
assert is_valid_type("Dict[str, int]")
assert is_valid_type("None")
assert is_valid_type("Literal[26]")
assert is_valid_type("Literal[0x1A]")
assert is_valid_type('Literal["hello world"]')
assert is_valid_type('Literal[b"hello world"]')
assert is_valid_type('Literal[u"hello world"]')
assert is_valid_type("Literal[True]")
assert is_valid_type("Literal[Color.RED]")
assert is_valid_type("Literal[None]")
assert is_valid_type(
'Literal[26, 0x1A, "hello world", b"hello world", u"hello world", True, Color.RED, None]'
)
assert not is_valid_type("foo-bar")
assert not is_valid_type("x->y")
assert not is_valid_type("True")
Expand Down
Loading
0