diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 47f43d6b..03294a29 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 @@ -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 diff --git a/src/test_typing_extensions.py b/src/test_typing_extensions.py index 3ef29474..cb3b462b 100644 --- a/src/test_typing_extensions.py +++ b/src/test_typing_extensions.py @@ -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]