[flake8-bugbear] Remove misleading multiple characters in lstrip

See https://pylint.readthedocs.io/en/stable/user_guide/messages/error/bad-str-strip-call.html
This commit is contained in:
Pierre Sassoulas 2024-02-02 21:21:39 +01:00
parent e7bab63537
commit b62d4b3527
2 changed files with 1 additions and 3 deletions

View File

@ -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

View File

@ -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}