From 6bba61253613cc24c37d34953da28a60cb80c4a5 Mon Sep 17 00:00:00 2001 From: Shwetha-H-Panduranga Date: Tue, 20 Dec 2011 17:42:27 +0530 Subject: Adding function 'expect' to atfutils. This function searches for 'actual_string' in 'expected_string'. If search successful, returns True. Else, returns False. --- libs/utils/atfutils.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/libs/utils/atfutils.py b/libs/utils/atfutils.py index 9b91ae2..86b2484 100644 --- a/libs/utils/atfutils.py +++ b/libs/utils/atfutils.py @@ -27,6 +27,22 @@ def assert_failure(**arguments): else: return 1 +def expect(actual_string, expected_string): + """ + """ + escaped_pattern = re.escape(expected_string) + new_pattern = re.compile(escaped_pattern, re.IGNORECASE) + + matched = False + if not expected_string: + matched = True + + else: + if re.search(new_pattern, actual_string): + matched = True + + return matched + def print_stdout(stdoutdata): """ """ -- cgit