Skip to content

Commit 1a538d4

Browse files
committed
clarify testReplaceIsDataclass
1 parent 0b95f3e commit 1a538d4

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

test-data/unit/check-dataclasses.test

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2237,11 +2237,11 @@ replace(None) # E: Value of type variable "_DataclassT" of "replace" cannot be
22372237
from dataclasses import is_dataclass, replace
22382238

22392239
def f(x: object) -> None:
2240-
# error before type-guard
2241-
y = replace(x) # E: Value of type variable "_DataclassT" of "replace" cannot be "object"
2242-
# no error after type-guard
2243-
if is_dataclass(x) and not isinstance(x, type):
2244-
y = replace(x)
2240+
_ = replace(x) # E: Value of type variable "_DataclassT" of "replace" cannot be "object"
2241+
if is_dataclass(x):
2242+
_ = replace(x) # E: Value of type variable "_DataclassT" of "replace" cannot be "Union[DataclassInstance, Type[DataclassInstance]]"
2243+
if not isinstance(x, type):
2244+
_ = replace(x)
22452245

22462246
[builtins fixtures/tuple.pyi]
22472247

0 commit comments

Comments
 (0)