summaryrefslogtreecommitdiff
path: root/tests/functional/g/generated_members.py
blob: ffb3de6314fe0918f90d008d87e2c3cbf630196e (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
"""Test the generated-members config option."""
# pylint: disable=pointless-statement, invalid-name
from __future__ import annotations
from astroid import nodes
from pylint import checkers

class Klass:
    """A class with a generated member."""

print(Klass().DoesNotExist)
print(Klass().aBC_set1)
print(Klass().ham.does.not_.exist)
print(Klass().spam.does.not_.exist)  # [no-member]
nodes.Tuple.does.not_.exist
checkers.base.doesnotexist()

session = Klass()
SESSION = Klass()
session.rollback()
SESSION.rollback()


# https://github.com/PyCQA/pylint/issues/6594
# Don't emit no-member inside type annotations
# with PEP 563 'from __future__ import annotations'
print(Klass.X)  # [no-member]
var: "Klass.X"
var2: Klass.X