Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
4 changes: 2 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ repos:
hooks:
- id: ruff
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
rev: v5.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -21,7 +21,7 @@ repos:
hooks:
- id: sphinx-lint
- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.33.0
rev: 0.33.2
hooks:
- id: check-dependabot
- id: check-github-workflows
Expand Down
8 changes: 5 additions & 3 deletions src/test_typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1207,13 +1207,15 @@ class My(enum.Enum):

self.assertEqual(Literal[My.A].__args__, (My.A,))

def test_illegal_parameters_do_not_raise_runtime_errors(self):
def test_strange_parameters_are_allowed(self):
# These are explicitly allowed by the typing spec
Literal[Literal[1, 2], Literal[4, 5]]
Literal[b"foo", "bar"]

# Type checkers should reject these types, but we do not
# raise errors at runtime to maintain maximum flexibility
Literal[int]
Literal[Literal[1, 2], Literal[4, 5]]
Literal[3j + 2, ..., ()]
Literal[b"foo", "bar"]
Literal[{"foo": 3, "bar": 4}]
Literal[T]

Expand Down
Loading