~ubuntu-branches/ubuntu/trusty/pylint/trusty

« back to all changes in this revision

Viewing changes to test/input/func_noerror_e1101_9588_base_attr_aug_assign.py

  • Committer: Bazaar Package Importer
  • Author(s): Sandro Tosi, Julien Lavergne, Alexandre Fayolle, Sandro Tosi
  • Date: 2009-09-14 23:52:18 UTC
  • mfrom: (7.1.1 sid)
  • Revision ID: james.westby@ubuntu.com-20090914235218-o3rtlhbskylm3l6d
[ Julien Lavergne ]
* Python 2.6 transition, thanks Alessio Treglia for the patch; Closes: #530509
 - Use --install-layout=deb for setup.py install.
 - Replace site-packages by *-packages.
 - Build-depends on python >= 2.5.4-1~ for --install-layout=deb.

[ Alexandre Fayolle ]
 * debian/rules: set NO_SETUPTOOLS when calling python setup.py

[ Sandro Tosi ]
* New upstream release
  - fix a false positive on E0611; thanks to Yann Dirson for the report;
    Closes: #546522
* debian/control
  - removed Conflicts and Replaces, no more needed
  - bump Standards-Version to 3.8.3 (no changes needed)
  - bump versioned dependencies on python-logilab-common and
    python-logilab-astng (to correctly handle migratation from pycentral to
    pysupport, hence the urgency)
* debian/README.source
  - removed, not needed

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# pylint: disable-msg=R0903
 
2
"""
 
3
False positive case of E1101:
 
4
 
 
5
The error is triggered when the attribute set in the base class is
 
6
modified with augmented assignment in a derived class.
 
7
 
 
8
http://www.logilab.org/ticket/9588
 
9
"""
 
10
__revision__ = 0
 
11
 
 
12
class BaseClass(object):
 
13
    "The base class"
 
14
    def __init__(self):
 
15
        "Set an attribute."
 
16
        self.e1101 = 1
 
17
 
 
18
class FalsePositiveClass(BaseClass):
 
19
    "The first derived class which triggers the false positive"
 
20
    def __init__(self):
 
21
        "Augmented assignment triggers E1101."
 
22
        BaseClass.__init__(self)
 
23
        self.e1101 += 1
 
24
 
 
25
    def countup(self):
 
26
        "Consequently this also triggers E1101."
 
27
        self.e1101 += 1
 
28
 
 
29
class NegativeClass(BaseClass):
 
30
    "The second derived class, which does not trigger the error E1101"
 
31
    def __init__(self):
 
32
        "Ordinary assignment is OK."
 
33
        BaseClass.__init__(self)
 
34
        self.e1101 = self.e1101 + 1
 
35
 
 
36
    def countup(self):
 
37
        "No problem."
 
38
        self.e1101 += 1
 
39