File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2143,6 +2143,51 @@ main:3: note: Possible overload variants:
21432143main:3: note: def foo(cls: Wrapper, x: int) -> int
21442144main:3: note: def foo(cls: Wrapper, x: str) -> str
21452145
2146+ [case testInitMovesAroundClassmethod]
2147+ [file m.py]
2148+ class C:
2149+ def __init__(self, x: int) -> None:
2150+ self._x = x
2151+ @classmethod
2152+ def create(cls, x: int) -> 'C':
2153+ return cls(x)
2154+ [file m.py.2]
2155+ class C:
2156+ @classmethod
2157+ def create(cls, x: int) -> 'C':
2158+ return cls(x)
2159+ def __init__(self, x: int) -> None:
2160+ self._x = x
2161+ [file m.py.3]
2162+ class C:
2163+ def __init__(self, x: int) -> None:
2164+ self._x = x
2165+ @classmethod
2166+ def create(cls, x: int) -> 'C':
2167+ return cls(x)
2168+ [builtins fixtures/classmethod.pyi]
2169+ [out]
2170+ ==
2171+ ==
2172+
2173+ [case testInitDisappearsClassmethodStays]
2174+ [file m.py]
2175+ class C:
2176+ def __init__(self, x: int) -> None:
2177+ self._x = x
2178+ @classmethod
2179+ def create(cls, x: int) -> 'C':
2180+ return cls(x)
2181+ [file m.py.2]
2182+ class C:
2183+ @classmethod
2184+ def create(cls, x: int) -> 'C':
2185+ return cls(x)
2186+ [builtins fixtures/classmethod.pyi]
2187+ [out]
2188+ ==
2189+ m.py:4: error: Too many arguments for "C"
2190+
21462191[case testRefreshGenericClass]
21472192from typing import TypeVar, Generic
21482193from a import A
You can’t perform that action at this time.
0 commit comments