diff options
Diffstat (limited to 'tests/functional/c/class_attributes.py')
-rw-r--r-- | tests/functional/c/class_attributes.py | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/functional/c/class_attributes.py b/tests/functional/c/class_attributes.py new file mode 100644 index 000000000..1d41f9d7a --- /dev/null +++ b/tests/functional/c/class_attributes.py @@ -0,0 +1,32 @@ +"""Test that valid class attribute doesn't trigger errors""" +__revision__ = 'sponge bob' +# pylint: disable=useless-object-inheritance,missing-docstring,too-few-public-methods + +class Clazz(object): + "dummy class" + + def __init__(self): + self.topic = 5 + self._data = 45 + + def change_type(self, new_class): + """Change type""" + self.__class__ = new_class + + def do_nothing(self): + "I do nothing useful" + return self.topic + 56 + + +class Base: + _class_prop: int + + +class Child(Base): + _class_prop = 42 + + def method(self): + print(self._class_prop) + + +Child().method() |