mirror of https://github.com/astral-sh/ruff
fix test expectations and TODOs
This commit is contained in:
parent
67ed2c4cdc
commit
3ff8a3c3db
|
|
@ -17,8 +17,7 @@ from datetime import time
|
|||
t = time(12, 0, 0)
|
||||
t = replace(t, minute=30)
|
||||
|
||||
# TODO: this should be `time`, once we support specialization of generic protocols
|
||||
reveal_type(t) # revealed: Unknown
|
||||
reveal_type(t) # revealed: time
|
||||
```
|
||||
|
||||
## The `__replace__` protocol
|
||||
|
|
@ -48,8 +47,7 @@ b = a.__replace__(x=3, y=4)
|
|||
reveal_type(b) # revealed: Point
|
||||
|
||||
b = replace(a, x=3, y=4)
|
||||
# TODO: this should be `Point`, once we support specialization of generic protocols
|
||||
reveal_type(b) # revealed: Unknown
|
||||
reveal_type(b) # revealed: Point
|
||||
```
|
||||
|
||||
A call to `replace` does not require all keyword arguments:
|
||||
|
|
@ -59,8 +57,7 @@ c = a.__replace__(y=4)
|
|||
reveal_type(c) # revealed: Point
|
||||
|
||||
d = replace(a, y=4)
|
||||
# TODO: this should be `Point`, once we support specialization of generic protocols
|
||||
reveal_type(d) # revealed: Unknown
|
||||
reveal_type(d) # revealed: Point
|
||||
```
|
||||
|
||||
Invalid calls to `__replace__` or `replace` will raise an error:
|
||||
|
|
|
|||
|
|
@ -1152,6 +1152,8 @@ d_int = DataWithDescription[int](1, "description") # OK
|
|||
reveal_type(d_int.data) # revealed: int
|
||||
reveal_type(d_int.description) # revealed: str
|
||||
|
||||
# TODO: only one error
|
||||
# error: [invalid-argument-type]
|
||||
# error: [invalid-argument-type]
|
||||
DataWithDescription[int](None, "description")
|
||||
```
|
||||
|
|
|
|||
|
|
@ -57,6 +57,8 @@ reveal_type(tuple((1, 2))) # revealed: tuple[Literal[1], Literal[2]]
|
|||
|
||||
reveal_type(tuple([1])) # revealed: tuple[Unknown | int, ...]
|
||||
|
||||
# TODO: one error
|
||||
# error: [invalid-argument-type]
|
||||
# error: [invalid-argument-type]
|
||||
reveal_type(tuple[int]([1])) # revealed: tuple[int]
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue