From 79eac09b2c498515d560dc1e954ab0c262c95d98 Mon Sep 17 00:00:00 2001 From: Michael Hanselmann <hansmi@google.com> Date: Mon, 7 Mar 2011 19:59:24 +0100 Subject: [PATCH] QA: Add utility to ensure item is not in sequence Signed-off-by: Michael Hanselmann <hansmi@google.com> Reviewed-by: Iustin Pop <iustin@google.com> --- qa/qa_utils.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/qa/qa_utils.py b/qa/qa_utils.py index ce33e628f..1beb77fa5 100644 --- a/qa/qa_utils.py +++ b/qa/qa_utils.py @@ -85,6 +85,14 @@ def AssertIn(item, sequence): raise qa_error.Error('%r not in %r' % (item, sequence)) +def AssertNotIn(item, sequence): + """Raises an error when item is in sequence. + + """ + if item in sequence: + raise qa_error.Error('%r in %r' % (item, sequence)) + + def AssertEqual(first, second): """Raises an error when values aren't equal. -- GitLab