QA: Add utility to ensure item is not in sequence
authorMichael Hanselmann <hansmi@google.com>
Mon, 7 Mar 2011 18:59:24 +0000 (19:59 +0100)
committerMichael Hanselmann <hansmi@google.com>
Tue, 8 Mar 2011 10:55:21 +0000 (11:55 +0100)
Signed-off-by: Michael Hanselmann <hansmi@google.com>
Reviewed-by: Iustin Pop <iustin@google.com>

qa/qa_utils.py

index ce33e62..1beb77f 100644 (file)
@@ -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.