From 08f891835557c2e7f92fb350e0dbe511b334faec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hugo=20H=C3=B6rnquist?= Date: Mon, 7 Aug 2023 15:25:12 +0200 Subject: Fix some linter warnings. --- mu4web/components.py | 2 +- mu4web/user/pam.py | 2 +- test/test_util.py | 12 ++++++------ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/mu4web/components.py b/mu4web/components.py index 07ab400..a73ea2f 100644 --- a/mu4web/components.py +++ b/mu4web/components.py @@ -132,7 +132,7 @@ def flashed_messages(messages: list[str] | list[tuple[str, str]]) -> HTML: """ if not messages: return [] - if type(messages[0]) == tuple: + if isinstance(messages[0], tuple): messages = cast(list[tuple[str, str]], messages) return ('ul', {'class': 'flashes'}, *[('li', msg) for (_, msg) in messages]) diff --git a/mu4web/user/pam.py b/mu4web/user/pam.py index c641ff8..3886297 100644 --- a/mu4web/user/pam.py +++ b/mu4web/user/pam.py @@ -9,5 +9,5 @@ class PamUser(User): def validate(self, password: str) -> bool: # noqa: 201 ret = pam.authenticate(self._username, password) - assert type(ret) == bool + assert isinstance(ret, bool) return ret diff --git a/test/test_util.py b/test/test_util.py index c83ac98..a86bf07 100644 --- a/test/test_util.py +++ b/test/test_util.py @@ -17,12 +17,12 @@ def test_split_path() -> None: def test_find(maildir: str) -> None: - assert [split_path(p)[-3:] for p in find(maildir, type='f')] == [ - [b'mail', b'cur', b'1691189956.3013485_5.gandalf:2,RS'], - [b'mail', b'cur', b'1691189958.3013485_7.gandalf:2,S'], - [b'mail', b'cur', b'1691314589.3192599_3.gandalf:2,S']] - assert [split_path(p)[-1] for p in find(maildir, type='d')] \ - == [b'mail', b'cur', b'new', b'tmp'] + assert sorted([split_path(p)[-3:] for p in find(maildir, type='f')]) == [ + [b'mail', b'cur', b'1691189956.3013485_5.gandalf:2,RS'], + [b'mail', b'cur', b'1691189958.3013485_7.gandalf:2,S'], + [b'mail', b'cur', b'1691314589.3192599_3.gandalf:2,S']] + assert sorted([split_path(p)[-1] for p in find(maildir, type='d')]) \ + == [b'cur', b'mail', b'new', b'tmp'] def test_cwd() -> None: -- cgit v1.2.3