mirror of https://github.com/astral-sh/ruff
fix; PT010; allow match and check keyword arguments
This commit is contained in:
parent
e2ec2bc306
commit
d5d257e86b
|
|
@ -126,6 +126,9 @@ impl Violation for PytestRaisesTooBroad {
|
|||
/// `pytest.raises` expects to receive an expected exception as its first
|
||||
/// argument. If omitted, the `pytest.raises` call will fail at runtime.
|
||||
///
|
||||
/// Note: As of pytest 8.4.0, calls with only `match` or `check` keyword
|
||||
/// arguments (without an exception class) are also valid.
|
||||
///
|
||||
/// ## Example
|
||||
/// ```python
|
||||
/// import pytest
|
||||
|
|
@ -181,6 +184,8 @@ pub(crate) fn raises_call(checker: &Checker, call: &ast::ExprCall) {
|
|||
.arguments
|
||||
.find_argument("expected_exception", 0)
|
||||
.is_none()
|
||||
&& call.arguments.find_keyword("match").is_none()
|
||||
&& call.arguments.find_keyword("check").is_none()
|
||||
{
|
||||
checker.report_diagnostic(PytestRaisesWithoutException, call.func.range());
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue