Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
6 changes: 3 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.6
rev: v0.12.2
hooks:
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- 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 @@ -22,7 +22,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
17 changes: 6 additions & 11 deletions src/test_typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -1211,7 +1211,7 @@ def test_illegal_parameters_do_not_raise_runtime_errors(self):
# 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[1, 2, 4, 5]
Literal[3j + 2, ..., ()]
Literal[b"foo", "bar"]
Literal[{"foo": 3, "bar": 4}]
Expand Down Expand Up @@ -1283,7 +1283,7 @@ def test_hash(self):
def test_args(self):
self.assertEqual(Literal[1, 2, 3].__args__, (1, 2, 3))
self.assertEqual(Literal[1, 2, 3, 3].__args__, (1, 2, 3))
self.assertEqual(Literal[1, Literal[2], Literal[3, 4]].__args__, (1, 2, 3, 4))
self.assertEqual(Literal[1, 2, 3, 4].__args__, (1, 2, 3, 4))
# Mutable arguments will not be deduplicated
self.assertEqual(Literal[[], []].__args__, ([], []))

Expand Down Expand Up @@ -1346,9 +1346,9 @@ class Ints(enum.IntEnum):
(Literal[1], Literal[Ints.B]))

def test_flatten(self):
l1 = Literal[Literal[1], Literal[2], Literal[3]]
l2 = Literal[Literal[1, 2], 3]
l3 = Literal[Literal[1, 2, 3]]
l1 = Literal[1, 2, 3]
l2 = Literal[1, 2, 3]
l3 = Literal[1, 2, 3]
for lit in l1, l2, l3:
self.assertEqual(lit, Literal[1, 2, 3])
self.assertEqual(lit.__args__, (1, 2, 3))
Expand All @@ -1359,12 +1359,7 @@ class Ints(enum.IntEnum):
A = 1
B = 2

literal = Literal[
Literal[Ints.A],
Literal[Ints.B],
Literal[1],
Literal[2],
]
literal = Literal[Ints.A, Ints.B, 1, 2]
self.assertEqual(literal.__args__, (Ints.A, Ints.B, 1, 2))

def test_caching_of_Literal_respects_type(self):
Expand Down
Loading