summaryrefslogtreecommitdiff
path: root/tests/functional/t/typevar_naming_style_rgx.py
blob: 6751e8d849d5fa88df9a06145bc23e0efe9af6af (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
"""Test case for typevar-name-missing-variance with non-default settings"""
from typing import TypeVar
import typing_extensions as te

# Name set by regex pattern
TypeVarsShouldBeLikeThis = TypeVar("TypeVarsShouldBeLikeThis")
TypeVarsShouldBeLikeThis_contra = TypeVar(
    "TypeVarsShouldBeLikeThis_contra", contravariant=True
)
TypeVarsShouldBeLikeThis_co = TypeVar("TypeVarsShouldBeLikeThis_co", covariant=True)

# Name using the standard style
GoodNameT = TypeVar("GoodNameT")  # [invalid-name]
GoodNameT_co = TypeVar("GoodNameT_co", covariant=True)  # [invalid-name]
GoodNameT_contra = TypeVar("GoodNameT_contra", contravariant=True)  # [invalid-name]


# -- typing_extensions.TypeVar --
TypeVarsShouldBeLikeThis = te.TypeVar("TypeVarsShouldBeLikeThis")
GoodNameT = te.TypeVar("GoodNameT")  # [invalid-name]
GoodNameT_co = te.TypeVar("GoodNameT_co", covariant=True)  # [invalid-name]