summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShwetha-H-Panduranga <shwetha@gluster.com>2011-12-20 17:42:27 +0530
committerShwetha-H-Panduranga <shwetha@gluster.com>2011-12-20 17:42:27 +0530
commit6bba61253613cc24c37d34953da28a60cb80c4a5 (patch)
tree3e5d72ad8430b51a289c3de40e3dea7f8990f574
parent57991580217d955984c68cd899d9031736182be0 (diff)
Adding function 'expect' to atfutils. This function searches for 'actual_string' in 'expected_string'. If search successful, returns True. Else, returns False.
-rw-r--r--libs/utils/atfutils.py16
1 files changed, 16 insertions, 0 deletions
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):
"""
"""