From fff278c198ab4852125d5781fb39b6863090faa7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Doktor?= Date: Tue, 20 Dec 2022 09:06:11 +0100 Subject: [PATCH] selftests: Allow multiple matches in one call MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit sometimes we want to check multiple parts of the same string. Signed-off-by: Lukáš Doktor --- selftests/core/__init__.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/selftests/core/__init__.py b/selftests/core/__init__.py index b53572f..dba2fb2 100644 --- a/selftests/core/__init__.py +++ b/selftests/core/__init__.py @@ -57,10 +57,10 @@ def check_calls(self, acts, exps): """ i = 0 for call in acts: - if exps[i] in str(call): + while exps[i] in str(call): i += 1 if len(exps) == i: - break + return self.assertEqual(i, len(exps), "Some calls were not present at all or" " in the expected order. Expected:\n%s\n\nActual:\n%s" % ("\n".join(str(_) for _ in exps),