Skip to content

Commit 7b907cf

Browse files
committed
add pythoneval test
1 parent 9cfc081 commit 7b907cf

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

test-data/unit/pythoneval.test

+20
Original file line numberDiff line numberDiff line change
@@ -1984,3 +1984,23 @@ def good9(foo1: Foo[Concatenate[int, P]], foo2: Foo[[int, str, bytes]], *args: P
19841984

19851985
[out]
19861986
_testStrictEqualitywithParamSpec.py:11: error: Non-overlapping equality check (left operand type: "Foo[[int]]", right operand type: "Bar[[int]]")
1987+
1988+
[case testDataclassReplace]
1989+
from dataclasses import dataclass, replace
1990+
1991+
@dataclass
1992+
class A:
1993+
x: int
1994+
1995+
1996+
a = A(x=42)
1997+
a2 = replace(a, x=42)
1998+
reveal_type(a2)
1999+
a2 = replace()
2000+
a2 = replace(a, x='spam')
2001+
a2 = replace(a, x=42, q=42)
2002+
[out]
2003+
_testDataclassReplace.py:10: note: Revealed type is "_testDataclassReplace.A"
2004+
_testDataclassReplace.py:11: error: Too few arguments for "replace"
2005+
_testDataclassReplace.py:12: error: Argument "x" to "replace" of "A" has incompatible type "str"; expected "int"
2006+
_testDataclassReplace.py:13: error: Unexpected keyword argument "q" for "replace" of "A"

0 commit comments

Comments
 (0)