Definition

To add additional expectation helpers, define a function that returns a boolean and register it:

import expecter

def can_meow(actual_value):
    return actual_value in {'cat', 'kitten'}

expecter.add_expectation(can_meow)

Usage

Custom helpers are available on the expect object:

>>> expect('kitten').can_meow()
>>> expect('puppy').can_meow()
Traceback (most recent call last):
...
AssertionError: Expected that 'puppy' can meow, but it can't