mirror of
https://github.com/astral-sh/ruff
synced 2026-01-21 05:20:49 -05:00
[flake8-pytest-style] Add check parameter example to PT017 docs (#22546)
## Summary - Adds an alternative example to the PT017 (`pytest-assert-in-except`) rule documentation showing pytest's `check` parameter for validating exceptions, available since pytest 8.4.0 Closes #22529 ## Test plan Documentation-only change. Verified with `uvx prek run -a`. Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
committed by
GitHub
parent
9a2990b2a1
commit
c98ea1bc24
@@ -106,6 +106,16 @@ impl Violation for PytestCompositeAssertion {
|
||||
/// assert exc_info.value.args
|
||||
/// ```
|
||||
///
|
||||
/// Or, for pytest 8.4.0 and later:
|
||||
/// ```python
|
||||
/// import pytest
|
||||
///
|
||||
///
|
||||
/// def test_foo():
|
||||
/// with pytest.raises(ZeroDivisionError, check=lambda e: e.args):
|
||||
/// 1 / 0
|
||||
/// ```
|
||||
///
|
||||
/// ## References
|
||||
/// - [`pytest` documentation: `pytest.raises`](https://docs.pytest.org/en/latest/reference/reference.html#pytest-raises)
|
||||
#[derive(ViolationMetadata)]
|
||||
|
||||
Reference in New Issue
Block a user