Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
f508d12
Add integration tests for type variable substitution
mrahtz Apr 5, 2022
ea104b9
Add tests for list, dict and tuple
mrahtz Apr 8, 2022
526d9e8
Add tests for Tuple
mrahtz Apr 9, 2022
0f022db
Revert "Add tests for Tuple"
mrahtz Apr 9, 2022
cc7bf8c
Make it easier to tests all tuple, list and dict types
mrahtz Apr 10, 2022
458b5dd
TypeVarSubstitutionTests -> GenericAliasSubstitutionTests
mrahtz Apr 10, 2022
0c8ba38
Remove question marks from cases I'm actually pretty sure about
mrahtz Apr 10, 2022
db24e70
Note that list[] should only take one argument
mrahtz Apr 11, 2022
15a4809
Leave unpacked tuples unsimplified
mrahtz Apr 11, 2022
0d7d2eb
Add generic[*Ts][*tuple[*Ts]]
mrahtz Apr 11, 2022
ab01c8a
Update comments based on decision to leave unpacked tuples unsimplified
mrahtz Apr 11, 2022
c4fe922
Add tests for generic[T1, bool, T2][*tuple[int, str]]
mrahtz Apr 15, 2022
d55b8fb
Update comments based on decision to unpack *some* tuples
mrahtz Apr 15, 2022
e858fc6
Note that generic[*tuple[()]] should raise TypeError
mrahtz Apr 16, 2022
3bc7d26
Note that C[T, *tuple[int, ...]][int] raises TypeError only because C…
mrahtz Apr 16, 2022
c980e4f
State that multiple unpackings should be allowed where possible
mrahtz Apr 16, 2022
95b7210
Add test for generic[T1, *tuple[int, ...], T2][str, bool, float]
mrahtz Apr 16, 2022
96394b1
Update comments according to revised tentative spec at https://github…
mrahtz Apr 16, 2022
ed9a557
Update expected comments to account for unpacked types only being val…
mrahtz Apr 18, 2022
faa9fc3
Merge branch 'main' into subst-tests
mrahtz Apr 18, 2022
9947fc0
Update to reflect results after merging latest main
mrahtz Apr 18, 2022
12496fc
Update ALL tests to reflect results after merging latest main
mrahtz Apr 18, 2022
db9af53
Remove comments saying we should get a TypeError in cases where we *d…
mrahtz Apr 18, 2022
c5b5a63
Update comments on expected results based on latest tentative spec at…
mrahtz Apr 29, 2022
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
Next Next commit
Leave unpacked tuples unsimplified
  • Loading branch information
mrahtz committed Apr 11, 2022
commit 15a48099849ea0367e5949c2e5a93a6643772695
14 changes: 7 additions & 7 deletions Lib/test/test_typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,9 @@ class C(Generic[T]): pass
('generic[T]', '[int, str]', 'TypeError'),
('generic[T]', '[tuple_type[int, ...]]', 'generic[tuple_type[int, ...]]'),
('generic[T]', '[*tuple_type[()]]', 'generic[*tuple_type[()]]'), # Should raise TypeError
('generic[T]', '[*tuple_type[int]]', 'generic[*tuple_type[int]]'), # Should be generic[int]
('generic[T]', '[*tuple_type[int]]', 'generic[*tuple_type[int]]'),
Comment thread
mrahtz marked this conversation as resolved.
Outdated
('generic[T]', '[*tuple_type[int, str]]', 'generic[*tuple_type[int, str]]'), # Should raise TypeError
('generic[T]', '[*tuple_type[int, ...]]', 'generic[*tuple_type[int, ...]]'), # Should be generic[int]?
('generic[T]', '[*tuple_type[int, ...]]', 'generic[*tuple_type[int, ...]]'),
('generic[T]', '[*Ts]', 'generic[*Ts]'), # Should raise TypeError
('generic[T]', '[T, *Ts]', 'TypeError'),
('generic[T]', '[*Ts, T]', 'TypeError'),
Expand Down Expand Up @@ -619,7 +619,7 @@ class C(Generic[T1, T2]): pass
('generic[T1, T2]', '[tuple_type[int, ...]]', 'TypeError'),
('generic[T1, T2]', '[tuple_type[int, ...], tuple_type[str, ...]]', 'generic[tuple_type[int, ...], tuple_type[str, ...]]'),
('generic[T1, T2]', '[*tuple_type[int, ...]]', 'TypeError'), # Should be generic[int, int]?
('generic[T1, T2]', '[*tuple_type[int, ...], *tuple_type[str, ...]]', 'generic[*tuple_type[int, ...], *tuple_type[str, ...]]'), # No idea what to do here
('generic[T1, T2]', '[*tuple_type[int, ...], *tuple_type[str, ...]]', 'generic[*tuple_type[int, ...], *tuple_type[str, ...]]'),
('generic[T1, T2]', '[*Ts]', 'TypeError'),
('generic[T1, T2]', '[T, *Ts]', 'generic[T, *Ts]'), # Should raise TypeError
('generic[T1, T2]', '[*Ts, T]', 'generic[*Ts, T]'), # Should raise TypeError
Expand Down Expand Up @@ -669,12 +669,12 @@ class C(Generic[*Ts]): pass
('Tuple[*Ts]', '[int, str]', 'Tuple[int, str]'),

('C[*Ts]', '[*tuple_type[int]]', 'C[*tuple_type[int]]'), # Should be C[int]
('tuple[*Ts]', '[*tuple_type[int]]', 'tuple[(*tuple_type[int],),]'), # Should be tuple[int]
('Tuple[*Ts]', '[*tuple_type[int]]', 'Tuple[*tuple_type[int]]'), # Should be Tuple[int]
('tuple[*Ts]', '[*tuple_type[int]]', 'tuple[(*tuple_type[int],),]'), # Should be tuple[*tuple_type[int]]
('Tuple[*Ts]', '[*tuple_type[int]]', 'Tuple[*tuple_type[int]]'), # Should be Tuple[*tuple_type[int]]

('C[*Ts]', '[*tuple_type[int, str]]', 'C[*tuple_type[int, str]]'), # Should be C[int, str]
('tuple[*Ts]', '[*tuple_type[int, str]]', 'tuple[(*tuple_type[int, str],),]'), # Should be tuple[int, str]
('Tuple[*Ts]', '[*tuple_type[int, str]]', 'Tuple[*tuple_type[int, str]]'), # Should be Tuple[int, str]
('tuple[*Ts]', '[*tuple_type[int, str]]', 'tuple[(*tuple_type[int, str],),]'), # Should be tuple[*tuple_type[int, str]]
('Tuple[*Ts]', '[*tuple_type[int, str]]', 'Tuple[*tuple_type[int, str]]'), # Should be Tuple[*tuple_type[int, str]]

('C[*Ts]', '[tuple_type[int, ...]]', 'C[tuple_type[int, ...]]'),
('tuple[*Ts]', '[tuple_type[int, ...]]', 'tuple[(tuple_type[int, ...],),]'), # Should be tuple[tuple_type[int, ...]]
Expand Down