ruff/crates/ruff_linter/resources/test/fixtures/flake8_pytest_style
Dylan 694e7ed52e
Less confidently mark f-strings as empty when inferring truthiness (#20152)
When computing the boolean value of an f-string, we over-eagerly
interpreted some f-string interpolations as empty. In this PR we now
mark the truthiness of f-strings involving format specs, debug text, and
bytes literals as "unknown".

This will probably result in some false negatives, which may be further
refined (for example - there are probably many cases where
`is_not_empty_f_string` should be modified to return `true`), but for
now at least we should have fewer false positives.

Affected rules (may not be an exhaustive list):

- [unnecessary-empty-iterable-within-deque-call
(RUF037)](https://docs.astral.sh/ruff/rules/unnecessary-empty-iterable-within-deque-call/#unnecessary-empty-iterable-within-deque-call-ruf037)
- [falsy-dict-get-fallback
(RUF056)](https://docs.astral.sh/ruff/rules/falsy-dict-get-fallback/#falsy-dict-get-fallback-ruf056)
- [pytest-assert-always-false
(PT015)](https://docs.astral.sh/ruff/rules/pytest-assert-always-false/#pytest-assert-always-false-pt015)
- [expr-or-not-expr
(SIM221)](https://docs.astral.sh/ruff/rules/expr-or-not-expr/#expr-or-not-expr-sim221)
- [expr-or-true
(SIM222)](https://docs.astral.sh/ruff/rules/expr-or-true/#expr-or-true-sim222)
- [expr-and-false
(SIM223)](https://docs.astral.sh/ruff/rules/expr-and-false/#expr-and-false-sim223)

Closes #19935
2025-08-29 22:12:54 +00:00
..
PT001.py [`flake8-pytest-style`] PT001/PT023 fix makes syntax error on parenthesized decorator (#18782) 2025-06-23 13:46:15 +02:00
PT002.py Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
PT003.py Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
PT006.py Fix `pytest-parametrize-names-wrong-type (PT006)` to edit both `argnames` and `argvalues` if both of them are single-element tuples/lists (#14699) 2024-12-09 09:58:52 +01:00
PT006_and_PT007.py Fix `pytest-parametrize-names-wrong-type (PT006)` to edit both `argnames` and `argvalues` if both of them are single-element tuples/lists (#14699) 2024-12-09 09:58:52 +01:00
PT007.py [`flake8-pytest-style`] Fix single-tuple conversion in `pytest-parametrize-values-wrong-type` (#10862) 2024-04-10 14:20:09 -04:00
PT008.py Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
PT009.py Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
PT010.py Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
PT011.py Add t-string fixtures for rules that do not need to be modified (#19146) 2025-07-14 09:46:31 -05:00
PT012.py [`flake8-pytest-style`] Do not emit diagnostics for empty `for` loops (`PT012`, `PT031`) (#15542) 2025-01-17 01:44:07 +00:00
PT013.py Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
PT014.py Fix `PT014` autofix for last item in list (#10532) 2024-03-23 09:26:42 -04:00
PT015.py Less confidently mark f-strings as empty when inferring truthiness (#20152) 2025-08-29 22:12:54 +00:00
PT016.py Add t-string fixtures for rules that do not need to be modified (#19146) 2025-07-14 09:46:31 -05:00
PT017.py Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
PT018.py Rename `Autofix` to `Fix` (#7657) 2023-09-28 10:53:05 +00:00
PT019.py [`flake8-pytest-style`] Don't recommend `usefixtures` for parametrize values in `PT019` (#17650) 2025-05-14 10:31:42 -04:00
PT020.py Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
PT021.py Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
PT022.py Update return type for `PT022` autofix (#7613) 2023-09-24 06:39:47 +00:00
PT023.py [`flake8-pytest-style`] PT001/PT023 fix makes syntax error on parenthesized decorator (#18782) 2025-06-23 13:46:15 +02:00
PT024.py Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
PT025.py Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
PT026.py Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
PT027_0.py Rename `ruff` crate to `ruff_linter` (#7529) 2023-09-20 08:38:27 +02:00
PT027_1.py [`flake8-pytest-style`] Rewrite references to `.exception` (`PT027`) (#15680) 2025-01-23 17:50:40 +01:00
PT028.py [`flake8-pytest-style`] Test function parameters with default arguments (`PT028`) (#15449) 2025-01-13 13:40:54 +01:00
PT029.py [`flake8-pytest-style`] Implement pytest.warns diagnostics (`PT029`, `PT030`, `PT031`) (#15444) 2025-01-13 01:46:59 +00:00
PT030.py Add t-string fixtures for rules that do not need to be modified (#19146) 2025-07-14 09:46:31 -05:00
PT031.py [`flake8-pytest-style`] Do not emit diagnostics for empty `for` loops (`PT012`, `PT031`) (#15542) 2025-01-17 01:44:07 +00:00
is_pytest_test.py [`flake8-pytest-style`] Test function parameters with default arguments (`PT028`) (#15449) 2025-01-13 13:40:54 +01:00