aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2023-08-07 15:25:12 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2023-08-07 15:25:12 +0200
commit08f891835557c2e7f92fb350e0dbe511b334faec (patch)
treee5210dbb98fd763a8f84b78f5d0abb1e2e3df50c
parentAdd tests. (diff)
downloadmu4web-08f891835557c2e7f92fb350e0dbe511b334faec.tar.gz
mu4web-08f891835557c2e7f92fb350e0dbe511b334faec.tar.xz
Fix some linter warnings.
-rw-r--r--mu4web/components.py2
-rw-r--r--mu4web/user/pam.py2
-rw-r--r--test/test_util.py12
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: