summaryrefslogtreecommitdiff
path: root/tests/functional/o/overridden_final_method_py38.py
blob: 252ea3c012b2eee6f584c6404a42daca203ee664 (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
26
27
28
29
30
31
"""Since Python version 3.8, a method decorated with typing.final cannot be
overridden"""

# pylint: disable=missing-docstring, too-few-public-methods

from typing import final

class Base:
    @final
    def my_method(self):
        pass


class Subclass(Base):
    def my_method(self): # [overridden-final-method]
        pass

# Check for crash on method definitions not at top level of class
# https://github.com/PyCQA/pylint/issues/5648
class BaseConditional:

    create_final_method = True
    if create_final_method:
        @final
        def my_method(self):
            pass

class Subclass2(BaseConditional):

    def my_method(self): # [overridden-final-method]
        pass