From b62d4b352748729c9e36f450226d191335177730 Mon Sep 17 00:00:00 2001 From: Pierre Sassoulas Date: Fri, 2 Feb 2024 21:21:39 +0100 Subject: [PATCH] [flake8-bugbear] Remove misleading multiple characters in lstrip See https://pylint.readthedocs.io/en/stable/user_guide/messages/error/bad-str-strip-call.html --- pyproject.toml | 1 - testing/test_warnings.py | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 062970ca7..89aab6a07 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -140,7 +140,6 @@ select = [ ignore = [ # bugbear ignore "B004", # Using `hasattr(x, "__call__")` to test if x is callable is unreliable. - "B005", # Using `.strip()` with multi-character strings is misleading "B006", # Do not use mutable data structures for argument defaults "B007", # Loop control variable `i` not used within loop body "B009", # Do not call `getattr` with a constant attribute value diff --git a/testing/test_warnings.py b/testing/test_warnings.py index 5a8a98015..5b2f27139 100644 --- a/testing/test_warnings.py +++ b/testing/test_warnings.py @@ -18,8 +18,7 @@ WARNINGS_SUMMARY_HEADER = "warnings summary" def pyfile_with_warnings(pytester: Pytester, request: FixtureRequest) -> str: """Create a test file which calls a function in a module which generates warnings.""" pytester.syspathinsert() - test_name = request.function.__name__ - module_name = test_name.lstrip("test_") + "_module" + module_name = request.function.__name__[len("test_") :] + "_module" test_file = pytester.makepyfile( f""" import {module_name}