[pre-commit.ci lite] apply automatic fixes
This commit is contained in:
parent
37de8242a9
commit
0035afb7c7
2 changed files with 7 additions and 5 deletions
|
|
@ -1,12 +1,15 @@
|
|||
import pytest
|
||||
|
||||
from flask import Flask
|
||||
|
||||
|
||||
def test_should_ignore_error_deprecation_warning():
|
||||
"""Minimal test: check DeprecationWarning and return value."""
|
||||
app = Flask(__name__)
|
||||
with pytest.warns(DeprecationWarning):
|
||||
assert app.should_ignore_error(None) is False
|
||||
|
||||
|
||||
@pytest.mark.parametrize("error", [Exception(), ValueError(), RuntimeError()])
|
||||
def test_should_ignore_error_multiple_exceptions(error):
|
||||
"""Verify that should_ignore_error issues a DeprecationWarning for multiple exception types."""
|
||||
|
|
@ -14,6 +17,7 @@ def test_should_ignore_error_multiple_exceptions(error):
|
|||
with pytest.warns(DeprecationWarning):
|
||||
assert app.should_ignore_error(error) is False
|
||||
|
||||
|
||||
def test_should_ignore_error_returns_false():
|
||||
"""Verify that should_ignore_error always returns False."""
|
||||
app = Flask(__name__)
|
||||
|
|
@ -21,9 +25,10 @@ def test_should_ignore_error_returns_false():
|
|||
result = app.should_ignore_error(Exception())
|
||||
assert result is False
|
||||
|
||||
|
||||
def test_should_ignore_error_warning_repeated_calls():
|
||||
"""Verify repeated calls each trigger a DeprecationWarning."""
|
||||
app = Flask(__name__)
|
||||
for _ in range(3):
|
||||
with pytest.warns(DeprecationWarning):
|
||||
assert app.should_ignore_error(Exception()) is False
|
||||
assert app.should_ignore_error(Exception()) is False
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue