summaryrefslogtreecommitdiff
path: root/tests/functional/u/undefined/undefined_variable_typing.py
blob: fda65cecaa31b00d16fbf1dcb6de6aa53e9c8866 (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
"""Tests for undefined-variable related to typing"""
# pylint: disable=invalid-name, import-error

# Ensure attribute lookups in type comments are accounted for.
# Reported in https://github.com/pylint-dev/pylint/issues/4603

from typing import TYPE_CHECKING, Any, Dict

import foo
from foo import Bar, Boo

a = ...  # type: foo.Bar
b = ...  # type: foo.Bar[Boo]
c = ...  # type: Bar.Boo


if TYPE_CHECKING:
    __additional_builtin__: Dict[str, Any]
    # For why this would emit redefined-builtin: https://github.com/pylint-dev/pylint/pull/3643
    # pylint: disable-next=redefined-builtin
    repr: Any


def run():
    """https://github.com/pylint-dev/pylint/issues/6388"""
    print(repr)
    return __additional_builtin__["test"]