Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f97fe24

Browse files
Actually assert in testSentinelReassignmentIsNotTypeAlias that reassignment does not result in a special form
Signed-off-by: Edgar Ramírez Mondragón <[email protected]>
1 parent b183f2a commit f97fe24

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

test-data/unit/check-sentinels.test

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,22 @@ def func(x: int | BUILTIN | TYPEXT) -> None:
175175

176176
[builtins fixtures/sentinel.pyi]
177177

178+
[case testSentinelReassignmentIsNotTypeAlias]
179+
from typing_extensions import sentinel
180+
181+
MISSING = sentinel("MISSING")
182+
ALIAS = MISSING
183+
184+
# Not a type alias (i.e. not a special form)
185+
reveal_type(ALIAS) # N: Revealed type is "MISSING"
186+
187+
def func(x: ALIAS | int = ALIAS) -> None:
188+
pass
189+
190+
func(MISSING)
191+
func(ALIAS)
192+
[builtins fixtures/tuple.pyi]
193+
178194
[case testSentinelReassignmentIsSameSentinel]
179195
from typing_extensions import sentinel, assert_type
180196

0 commit comments

Comments
 (0)