Skip to content

Commit 1e752e2

Browse files
Add a test for sentinel assigment
Signed-off-by: Edgar Ramírez Mondragón <edgarrm358@gmail.com>
1 parent ff4d71b commit 1e752e2

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

test-data/unit/check-sentinels.test

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,3 +216,16 @@ def func(d: dict[str, str]) -> None:
216216
var = d.get("key", Unknown)
217217
x: int = var # E: Incompatible types in assignment (expression has type "str | Unknown", variable has type "int")
218218
[builtins fixtures/dict-full.pyi]
219+
220+
[case testAssignSentinel]
221+
from typing_extensions import sentinel
222+
223+
X = sentinel("X")
224+
225+
def inspect_sentinel(arg: sentinel) -> None: ...
226+
227+
reveal_type(X) # N: Revealed type is "X?"
228+
reveal_type(inspect_sentinel) # N: Revealed type is "def (arg: typing_extensions.Sentinel)"
229+
inspect_sentinel(arg=X)
230+
231+
[builtins fixtures/tuple.pyi]

0 commit comments

Comments
 (0)