From 91d4dc3ef1360b3e4394e6784d33f5aecf7ad485 Mon Sep 17 00:00:00 2001 From: Peter Bieringer Date: Tue, 12 Aug 2025 16:42:06 +0200 Subject: [PATCH] make mypy happy --- radicale/tests/test_storage.py | 36 ++++++++++++++++++++++++++++------ 1 file changed, 30 insertions(+), 6 deletions(-) diff --git a/radicale/tests/test_storage.py b/radicale/tests/test_storage.py index d6ecefbb..9b077180 100644 --- a/radicale/tests/test_storage.py +++ b/radicale/tests/test_storage.py @@ -200,7 +200,11 @@ class TestMultiFileSystem(BaseTest): for line in caplog.messages: if line.find("\"hook-json ") != -1: found = 1 - s = re.search('.*\"hook-json ({.*})".*', line).group(1).replace("'", "\"") + r = re.search('.*\"hook-json ({.*})".*', line) + if r: + s = r.group(1).replace("'", "\"") + else: + break d = json.loads(s) if d["user"] == "Anonymous": found = found | 2 @@ -237,7 +241,11 @@ class TestMultiFileSystem(BaseTest): for line in caplog.messages: if line.find("\"hook-json ") != -1: found = 1 - s = re.search('.*\"hook-json ({.*})".*', line).group(1).replace("'", "\"") + r = re.search('.*\"hook-json ({.*})".*', line) + if r: + s = r.group(1).replace("'", "\"") + else: + break d = json.loads(s) if d["user"] == "Anonymous": found = found | 2 @@ -270,7 +278,11 @@ class TestMultiFileSystem(BaseTest): for line in caplog.messages: if line.find("\"hook-json ") != -1: found = 1 - s = re.search('.*\"hook-json ({.*})".*', line).group(1).replace("'", "\"") + r = re.search('.*\"hook-json ({.*})".*', line) + if r: + s = r.group(1).replace("'", "\"") + else: + break d = json.loads(s) if d["user"] == "Anonymous": found = found | 2 @@ -303,7 +315,11 @@ class TestMultiFileSystem(BaseTest): for line in caplog.messages: if line.find("\"hook-json ") != -1: found = 1 - s = re.search('.*\"hook-json ({.*})".*', line).group(1).replace("'", "\"") + r = re.search('.*\"hook-json ({.*})".*', line) + if r: + s = r.group(1).replace("'", "\"") + else: + break d = json.loads(s) if d["user"] == "Anonymous": found = found | 2 @@ -338,7 +354,11 @@ class TestMultiFileSystem(BaseTest): for line in caplog.messages: if line.find("\"hook-json ") != -1: found = 1 - s = re.search('.*\"hook-json ({.*})".*', line).group(1).replace("'", "\"") + r = re.search('.*\"hook-json ({.*})".*', line) + if r: + s = r.group(1).replace("'", "\"") + else: + break d = json.loads(s) if d["user"] == "Anonymous": found = found | 2 @@ -377,7 +397,11 @@ class TestMultiFileSystem(BaseTest): for line in caplog.messages: if line.find("\"hook-json ") != -1: found = 1 - s = re.search('.*\"hook-json ({.*})".*', line).group(1).replace("'", "\"") + r = re.search('.*\"hook-json ({.*})".*', line) + if r: + s = r.group(1).replace("'", "\"") + else: + break d = json.loads(s) if d["user"] == "Anonymous": found = found | 2