fix test expectations and TODOs

This commit is contained in:
Douglas Creager 2025-12-15 16:46:00 -05:00
parent 67ed2c4cdc
commit 3ff8a3c3db
3 changed files with 7 additions and 6 deletions

View File

@ -17,8 +17,7 @@ from datetime import time
t = time(12, 0, 0) t = time(12, 0, 0)
t = replace(t, minute=30) t = replace(t, minute=30)
# TODO: this should be `time`, once we support specialization of generic protocols reveal_type(t) # revealed: time
reveal_type(t) # revealed: Unknown
``` ```
## The `__replace__` protocol ## The `__replace__` protocol
@ -48,8 +47,7 @@ b = a.__replace__(x=3, y=4)
reveal_type(b) # revealed: Point reveal_type(b) # revealed: Point
b = replace(a, x=3, y=4) b = replace(a, x=3, y=4)
# TODO: this should be `Point`, once we support specialization of generic protocols reveal_type(b) # revealed: Point
reveal_type(b) # revealed: Unknown
``` ```
A call to `replace` does not require all keyword arguments: A call to `replace` does not require all keyword arguments:
@ -59,8 +57,7 @@ c = a.__replace__(y=4)
reveal_type(c) # revealed: Point reveal_type(c) # revealed: Point
d = replace(a, y=4) d = replace(a, y=4)
# TODO: this should be `Point`, once we support specialization of generic protocols reveal_type(d) # revealed: Point
reveal_type(d) # revealed: Unknown
``` ```
Invalid calls to `__replace__` or `replace` will raise an error: Invalid calls to `__replace__` or `replace` will raise an error:

View File

@ -1152,6 +1152,8 @@ d_int = DataWithDescription[int](1, "description") # OK
reveal_type(d_int.data) # revealed: int reveal_type(d_int.data) # revealed: int
reveal_type(d_int.description) # revealed: str reveal_type(d_int.description) # revealed: str
# TODO: only one error
# error: [invalid-argument-type]
# error: [invalid-argument-type] # error: [invalid-argument-type]
DataWithDescription[int](None, "description") DataWithDescription[int](None, "description")
``` ```

View File

@ -57,6 +57,8 @@ reveal_type(tuple((1, 2))) # revealed: tuple[Literal[1], Literal[2]]
reveal_type(tuple([1])) # revealed: tuple[Unknown | int, ...] reveal_type(tuple([1])) # revealed: tuple[Unknown | int, ...]
# TODO: one error
# error: [invalid-argument-type]
# error: [invalid-argument-type] # error: [invalid-argument-type]
reveal_type(tuple[int]([1])) # revealed: tuple[int] reveal_type(tuple[int]([1])) # revealed: tuple[int]