diff options
author | Joe Young <80432516+jpy-git@users.noreply.github.com> | 2022-03-31 07:25:16 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-31 08:25:16 +0200 |
commit | 2f11e093eecdfa2008bf1f0a8b1ed31e58f8cc60 (patch) | |
tree | c326e079aba09716c943e2a2e59b2565a838bda1 /pylint/checkers/base_checker.py | |
parent | 9d7424d731f309a3061d69de590d0a1cc6f814cb (diff) | |
download | pylint-git-2f11e093eecdfa2008bf1f0a8b1ed31e58f8cc60.tar.gz |
Total ordering unit test for BaseChecker (#6059)
Co-authored-by: Daniƫl van Noord <13665637+DanielNoord@users.noreply.github.com>
Diffstat (limited to 'pylint/checkers/base_checker.py')
-rw-r--r-- | pylint/checkers/base_checker.py | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/pylint/checkers/base_checker.py b/pylint/checkers/base_checker.py index 31e178b32..86ba6e73a 100644 --- a/pylint/checkers/base_checker.py +++ b/pylint/checkers/base_checker.py @@ -61,7 +61,15 @@ class BaseChecker(OptionsProviderMixIn): def __gt__(self, other): """Permit to sort a list of Checker by name.""" - return f"{self.name}{self.msgs}" > (f"{other.name}{other.msgs}") + return f"{self.name}{self.msgs}" > f"{other.name}{other.msgs}" + + def __eq__(self, other): + """Permit to assert Checkers are equal.""" + return f"{self.name}{self.msgs}" == f"{other.name}{other.msgs}" + + def __hash__(self): + """Make Checker hashable.""" + return hash(f"{self.name}{self.msgs}") def __repr__(self): status = "Checker" if self.enabled else "Disabled checker" |