summaryrefslogtreecommitdiff
path: root/pylint/testutils
diff options
context:
space:
mode:
authorPierre Sassoulas <pierre.sassoulas@gmail.com>2022-11-07 17:19:52 +0100
committerGitHub <noreply@github.com>2022-11-07 17:19:52 +0100
commita04f641c9d9d95c232db81aa4649a00e7e7e87e1 (patch)
treeb3c42bc1f59b2d6cc8e6260aead993bee8d13423 /pylint/testutils
parentf262c43bc430d7146d0cc9a9bd968fc89981e01e (diff)
downloadpylint-git-a04f641c9d9d95c232db81aa4649a00e7e7e87e1.tar.gz
[use-implicit-booleaness] Fix comparison to empty strings across the codebase (#7722)
As it will become a default check in #6870 it will be easier to review it if we separate the two
Diffstat (limited to 'pylint/testutils')
-rw-r--r--pylint/testutils/_primer/primer_compare_command.py11
-rw-r--r--pylint/testutils/utils.py2
2 files changed, 6 insertions, 7 deletions
diff --git a/pylint/testutils/_primer/primer_compare_command.py b/pylint/testutils/_primer/primer_compare_command.py
index baf28d8b7..442ffa227 100644
--- a/pylint/testutils/_primer/primer_compare_command.py
+++ b/pylint/testutils/_primer/primer_compare_command.py
@@ -63,15 +63,14 @@ class CompareCommand(PrimerCommand):
comment += self._create_comment_for_package(
package, new_messages, missing_messages
)
- if comment == "":
- comment = (
+ comment = (
+ f"🤖 **Effect of this PR on checked open source code:** 🤖\n\n{comment}"
+ if comment
+ else (
"🤖 According to the primer, this change has **no effect** on the"
" checked open source code. 🤖🎉\n\n"
)
- else:
- comment = (
- f"🤖 **Effect of this PR on checked open source code:** 🤖\n\n{comment}"
- )
+ )
return self._truncate_comment(comment)
def _create_comment_for_package(
diff --git a/pylint/testutils/utils.py b/pylint/testutils/utils.py
index 4d5b82867..292e991c2 100644
--- a/pylint/testutils/utils.py
+++ b/pylint/testutils/utils.py
@@ -93,7 +93,7 @@ def create_files(paths: list[str], chroot: str = ".") -> None:
path = os.path.join(chroot, path)
filename = os.path.basename(path)
# path is a directory path
- if filename == "":
+ if not filename:
dirs.add(path)
# path is a filename path
else: