summaryrefslogtreecommitdiff
path: root/tests/functional/t/typing_generic.py
blob: 66b8ce4fcebb7dee6ab7099b64510cb402efc9d8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# pylint: disable=missing-docstring,invalid-name,too-few-public-methods

# https://github.com/pylint-dev/pylint/issues/2822
# Base should be subscriptable, even with ABCMeta as metaclass
from abc import ABC, ABCMeta
from typing import Generic, TypeVar

T = TypeVar("T")

class Base(Generic[T], metaclass=ABCMeta):
    """Base"""

class Impl(Base[str]):
    """Impl"""


# https://github.com/pylint-dev/astroid/issues/942
Anything = TypeVar("Anything")
MoreSpecific = TypeVar("MoreSpecific", str, int)

class A(ABC, Generic[Anything]):
    def a_method(self) -> None:
        print("hello")

class B(A[MoreSpecific]):
    pass

class C(B[str]):
    pass

c = C()
c.a_method()  # should NOT emit `no-member` error