summaryrefslogtreecommitdiff
path: root/tests/functional/p/protected_access_special_methods_off.py
blob: 8747b425e9d3fb7bd3801d366f6c34ce395b483b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
"""Test that when check-protected-access-in-special-methods is False (default)
no protected-access message emission for single underscore prefixed names
inside special methods occur
"""
# pylint: disable=missing-class-docstring, invalid-name, unused-variable
# pylint: disable=too-few-public-methods


class Protected:
    """A class"""

    def __init__(self):
        self._protected = 42
        self.public = "A"
        self.__private = None  # [unused-private-member]

    def __eq__(self, other):
        self._protected = other._protected

    def _fake_special_(self, other):
        a = other.public
        self.public = other._protected  # [protected-access]
        self.__private = other.__private  # [protected-access, unused-private-member]