Skip to content

Commit

Permalink
Add documentation examples for overridden-final-method checker (#…
Browse files Browse the repository at this point in the history
…6080)

* Add a `pylintrc` to ensure Python version 3.8 is the minimum version used for the `overridden-final-method` documentation test

Co-authored-by: Pierre Sassoulas <pierre.sassoulas@gmail.com>
  • Loading branch information
mbyrnepr2 and Pierre-Sassoulas authored Apr 5, 2022
1 parent c4e9afe commit ff5c7e3
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 0 deletions.
12 changes: 12 additions & 0 deletions doc/data/messages/o/overridden-final-method/bad.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from typing import final


class Animal:
@final
def can_breathe(self):
return True


class Cat(Animal):
def can_breathe(self): # [overridden-final-method]
pass
1 change: 1 addition & 0 deletions doc/data/messages/o/overridden-final-method/details.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The message can't be emitted when using Python < 3.8.
12 changes: 12 additions & 0 deletions doc/data/messages/o/overridden-final-method/good.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
from typing import final


class Animal:
@final
def can_breathe(self):
return True


class Cat(Animal):
def can_purr(self):
return True
2 changes: 2 additions & 0 deletions doc/data/messages/o/overridden-final-method/pylintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[testoptions]
min_pyver=3.8
1 change: 1 addition & 0 deletions doc/data/messages/o/overridden-final-method/related.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- `PEP 591 <https://peps.python.org/pep-0591/>`_

0 comments on commit ff5c7e3

Please sign in to comment.