Skip to content

Commit

Permalink
clarify testReplaceIsDataclass
Browse files Browse the repository at this point in the history
  • Loading branch information
ikonst committed Aug 28, 2023
1 parent 0b95f3e commit 1a538d4
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions test-data/unit/check-dataclasses.test
Original file line number Diff line number Diff line change
Expand Up @@ -2237,11 +2237,11 @@ replace(None) # E: Value of type variable "_DataclassT" of "replace" cannot be
from dataclasses import is_dataclass, replace

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

[builtins fixtures/tuple.pyi]

Expand Down

0 comments on commit 1a538d4

Please sign in to comment.