summaryrefslogtreecommitdiff
path: root/tests/functional/u/unused/unused_import_class_def_keyword.py
blob: 0d6b5998736b6b4b627732a4a69dc3e157230900 (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
33
34
35
36
37
38
"""
Test false-positive for unused-import on class keyword arguments

    https://github.com/PyCQA/pylint/issues/3202
"""
# pylint: disable=missing-docstring,too-few-public-methods,invalid-name,import-error

# Imports don't exist! Only check `unused-import`
from const import DOMAIN
from const import DOMAIN_2
from const import DOMAIN_3


class Child:
    def __init_subclass__(cls, **kwargs):
        pass

class Parent(Child, domain=DOMAIN):
    pass


# Alternative 1
class Parent_2(Child, domain=DOMAIN_2):
    DOMAIN_2 = DOMAIN_2


# Alternative 2
class A:
    def __init__(self, arg):
        pass

class B:
    CONF = "Hello World"
    SCHEMA = A(arg=CONF)


# Test normal instantiation
A(arg=DOMAIN_3)