summaryrefslogtreecommitdiff
path: root/tests/integration_tests/log_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/integration_tests/log_utils.py')
-rw-r--r--tests/integration_tests/log_utils.py13
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/integration_tests/log_utils.py b/tests/integration_tests/log_utils.py
new file mode 100644
index 00000000..fa807389
--- /dev/null
+++ b/tests/integration_tests/log_utils.py
@@ -0,0 +1,13 @@
+def ordered_items_in_text(to_verify: list, text: str) -> bool:
+ """Return if all items in list appear in order in text.
+
+ Examples:
+ ordered_items_in_text(['a', '1'], 'ab1') # Returns True
+ ordered_items_in_text(['1', 'a'], 'ab1') # Returns False
+ """
+ index = 0
+ for item in to_verify:
+ index = text[index:].find(item)
+ if index < 0:
+ return False
+ return True