blob: 64d0007a5fb31b5fab315fc3f4a7707c30156694 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
"""Tests for undefined-variable related to classes"""
# pylint: disable=missing-function-docstring, missing-class-docstring, too-few-public-methods
# Test that list comprehensions in base classes are scoped correctly
# Regression reported in https://github.com/pylint-dev/pylint/issues/3434
import collections
l = ["a", "b", "c"]
class Foo(collections.namedtuple("Foo", [x + "_foo" for x in l])):
pass
# Test that class attributes are in scope for return type annotations.
# Regression reported in https://github.com/pylint-dev/pylint/issues/1976
class MyObject:
class MyType:
pass
def my_method(self) -> MyType:
pass
|