-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add an exception for
IndexError
inside uninferable_final_decorator
(
#6532) Co-authored-by: Pierre Sassoulas <[email protected]> Co-authored-by: Daniël van Noord <[email protected]>
- Loading branch information
1 parent
45cbae2
commit 18cb026
Showing
4 changed files
with
55 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
30 changes: 30 additions & 0 deletions
30
tests/functional/r/regression/regression_6531_crash_index_error.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
"""Regression test for https://github.com/PyCQA/pylint/issues/6531.""" | ||
|
||
# pylint: disable=missing-docstring, redefined-outer-name | ||
|
||
import pytest | ||
|
||
|
||
class Wallet: | ||
def __init__(self): | ||
self.balance = 0 | ||
|
||
def add_cash(self, earned): | ||
self.balance += earned | ||
|
||
def spend_cash(self, spent): | ||
self.balance -= spent | ||
|
||
@pytest.fixture | ||
def my_wallet(): | ||
'''Returns a Wallet instance with a zero balance''' | ||
return Wallet() | ||
|
||
@pytest.mark.parametrize("earned,spent,expected", [ | ||
(30, 10, 20), | ||
(20, 2, 18), | ||
]) | ||
def test_transactions(my_wallet, earned, spent, expected): | ||
my_wallet.add_cash(earned) | ||
my_wallet.spend_cash(spent) | ||
assert my_wallet.balance == expected |