summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSylvain Thénault <sylvain.thenault@logilab.fr>2009-08-27 01:56:20 +0200
committerSylvain Thénault <sylvain.thenault@logilab.fr>2009-08-27 01:56:20 +0200
commit8c77ea6bd8be1ba601aa2f203dab1d562f02940b (patch)
tree0f1840d45eab472ba3df89c2726fd28dd7e75f63
parent55c14a9c4e407cc318e9dd46a492258fabc74bc7 (diff)
downloadpylint-git-8c77ea6bd8be1ba601aa2f203dab1d562f02940b.tar.gz
add test for #9588: false positive E1101 for augmented assignment
-rw-r--r--test/input/func_noerror_e1101_9588_base_attr_aug_assign.py39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/input/func_noerror_e1101_9588_base_attr_aug_assign.py b/test/input/func_noerror_e1101_9588_base_attr_aug_assign.py
new file mode 100644
index 000000000..42041460a
--- /dev/null
+++ b/test/input/func_noerror_e1101_9588_base_attr_aug_assign.py
@@ -0,0 +1,39 @@
+# pylint: disable-msg=R0903
+"""
+False positive case of E1101:
+
+The error is triggered when the attribute set in the base class is
+modified with augmented assignment in a derived class.
+
+http://www.logilab.org/ticket/9588
+"""
+__revision__ = 0
+
+class BaseClass(object):
+ "The base class"
+ def __init__(self):
+ "Set an attribute."
+ self.e1101 = 1
+
+class FalsePositiveClass(BaseClass):
+ "The first derived class which triggers the false positive"
+ def __init__(self):
+ "Augmented assignment triggers E1101."
+ BaseClass.__init__(self)
+ self.e1101 += 1
+
+ def countup(self):
+ "Consequently this also triggers E1101."
+ self.e1101 += 1
+
+class NegativeClass(BaseClass):
+ "The second derived class, which does not trigger the error E1101"
+ def __init__(self):
+ "Ordinary assignment is OK."
+ BaseClass.__init__(self)
+ self.e1101 = self.e1101 + 1
+
+ def countup(self):
+ "No problem."
+ self.e1101 += 1
+