blob: fd7fa40868cbc2e620b27bc19e0b264ab85ad0d3 (
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
|
"""Unit tests for the variables checker."""
import unittest
from astroid import test_utils
from pylint.checkers import classes
from pylint.testutils import CheckerTestCase, Message
class VariablesCheckerTC(CheckerTestCase):
CHECKER_CLASS = classes.ClassChecker
def test_bitbucket_issue_164(self):
"""Issue 164 report a false negative for access-member-before-definition"""
n1, n2 = test_utils.extract_node("""
class MyClass1(object):
def __init__(self):
self.first += 5 #@
self.first = 0 #@
""")
with self.assertAddsMessages(Message('access-member-before-definition',
node=n1.target, args=('first', n2.lineno))):
self.walk(n1.root())
if __name__ == '__main__':
unittest.main()
|