Yelp/Testify — Issue #46: new assertion type
Author: jimk
Created: 2012-01-26 02:57:55+00:00
State: open

Please add the following new assertion type to assertions.py:

def assert_either(items, sequence):
for item in items:
if item in sequence:
return
assert False, "assertion failed: expected one of %r in %r" % (items, sequence)

It allows a user to send a list or tuple of items that are expected in the sequence. This is useful for web elements that can have a transition other than visible and "hidden". In my case, there's an intermediary transition of "fade out" so I needed my validation to allow either "fade out" or "hidden" to be found in the class sequence.