[case testAbstractMethods]
from abc import abstractmethod, ABCMeta
import typing

class A(metaclass=ABCMeta):
  @abstractmethod
  def g(self) -> 'A': pass
  @abstractmethod
  def f(self) -> 'A': return self
[out]
MypyFile:1(
  ImportFrom:1(abc, [abstractmethod, ABCMeta])
  Import:2(typing)
  ClassDef:4(
    A
    Metaclass(NameExpr(ABCMeta [abc.ABCMeta]))
    Decorator:5(
      Var(g)
      FuncDef:6(
        g
        Args(
          Var(self))
        def (self: __main__.A) -> __main__.A
        Abstract
        Block:6(
          PassStmt:6())))
    Decorator:7(
      Var(f)
      FuncDef:8(
        f
        Args(
          Var(self))
        def (self: __main__.A) -> __main__.A
        Abstract
        Block:8(
          ReturnStmt:8(
            NameExpr(self [l])))))))

[case testClassInheritingTwoAbstractClasses]
from abc import abstractmethod, ABCMeta
import typing

class A(metaclass=ABCMeta): pass
class B(metaclass=ABCMeta): pass
class C(A, B): pass
[out]
MypyFile:1(
  ImportFrom:1(abc, [abstractmethod, ABCMeta])
  Import:2(typing)
  ClassDef:4(
    A
    Metaclass(NameExpr(ABCMeta [abc.ABCMeta]))
    PassStmt:4())
  ClassDef:5(
    B
    Metaclass(NameExpr(ABCMeta [abc.ABCMeta]))
    PassStmt:5())
  ClassDef:6(
    C
    BaseType(
      __main__.A
      __main__.B)
    PassStmt:6()))

[case testAbstractGenericClass]
from abc import abstractmethod
from typing import Generic, TypeVar
T = TypeVar('T')
class A(Generic[T]):
  @abstractmethod
  def f(self) -> 'A[T]': pass
[out]
MypyFile:1(
  ImportFrom:1(abc, [abstractmethod])
  ImportFrom:2(typing, [Generic, TypeVar])
  AssignmentStmt:3(
    NameExpr(T* [__main__.T])
    TypeVarExpr:3())
  ClassDef:4(
    A
    TypeVars(
      T)
    Decorator:5(
      Var(f)
      FuncDef:6(
        f
        Args(
          Var(self))
        def (self: __main__.A[T`1]) -> __main__.A[T`1]
        Abstract
        Block:6(
          PassStmt:6())))))

[case testFullyQualifiedAbstractMethodDecl]
import abc
from abc import ABCMeta
import typing

class A(metaclass=ABCMeta):
  @abc.abstractmethod
  def g(self) -> 'A': pass
[out]
MypyFile:1(
  Import:1(abc)
  ImportFrom:2(abc, [ABCMeta])
  Import:3(typing)
  ClassDef:5(
    A
    Metaclass(NameExpr(ABCMeta [abc.ABCMeta]))
    Decorator:6(
      Var(g)
      FuncDef:7(
        g
        Args(
          Var(self))
        def (self: __main__.A) -> __main__.A
        Abstract
        Block:7(
          PassStmt:7())))))
