Skip to content

Commit fc17388

Browse files
committed
Add ABC test case
1 parent 9cf43ff commit fc17388

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

mypyc/test-data/annotate-basic.test

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,3 +433,46 @@ class C:
433433
def f2() -> None:
434434
c = C()
435435
c.d() # A: Call non-native method "d" (it may be defined in a non-native class, or decorated).
436+
437+
[case testAnnotateCallDifferentKindsOfMethods]
438+
from abc import ABC, abstractmethod
439+
440+
class C:
441+
@staticmethod
442+
def s() -> None: ...
443+
444+
@classmethod
445+
def c(cls) -> None: ...
446+
447+
@property
448+
def p(self) -> int:
449+
return 0
450+
451+
@property
452+
def p2(self) -> int:
453+
return 0
454+
455+
@p2.setter
456+
def p2(self, x: int) -> None:
457+
pass
458+
459+
def f1() -> int:
460+
c = C()
461+
c.s()
462+
c.c()
463+
c.p2 = 1
464+
return c.p + c.p2
465+
466+
class A(ABC):
467+
@abstractmethod
468+
def m(self) -> int:
469+
raise NotImplementedError # A: Get non-native attribute "NotImplementedError".
470+
471+
class D(A):
472+
def m(self) -> int:
473+
return 1
474+
475+
def f2() -> int:
476+
d = D()
477+
return d.m()
478+

0 commit comments

Comments
 (0)