# Path: taipan/functional/functions.py
# def identity():
#     """Returns an identity function.
#     :return: Function that returns the argument passed in verbatim
#     """
#     return lambda x: x
# 
# Path: taipan/testing/_unittest.py



from taipan.functional.functions import identity
from taipan.testing._unittest import skip
"""
Decorators for skipping tests.
"""


__all__ = [
    'skipIfReturnsTrue', 'skipUnlessReturnsTrue',
    'skipIfReturnsFalse', 'skipUnlessReturnsFalse',
    'skipIfHasattr', 'skipUnlessHasattr',
]


# TODO(xion): come up with better name
def skipIfReturnsTrue(predicate):
    """Decorator that will cause a test to be skipped
    if given ``predicate`` callable evaluates to true.
    """
    if predicate():
        desc = getattr(predicate, '__doc__', None) or repr(predicate)

# Path: taipan/functional/functions.py
# def identity():
#     """Returns an identity function.
#     :return: Function that returns the argument passed in verbatim
#     """
#     return lambda x: x
# 
# Path: taipan/testing/_unittest.py



# Path: taipan/testing/skips.py
from taipan.functional.functions import identity
from taipan.testing._unittest import skip

"""
Decorators for skipping tests.
"""


__all__ = [
    'skipIfReturnsTrue', 'skipUnlessReturnsTrue',
    'skipIfReturnsFalse', 'skipUnlessReturnsFalse',
    'skipIfHasattr', 'skipUnlessHasattr',
]


# TODO(xion): come up with better name
def skipIfReturnsTrue(predicate):
    """Decorator that will cause a test to be skipped
    if given ``predicate`` callable evaluates to true.
    """
    if predicate():
        desc = getattr(predicate, '__doc__', None) or repr(predicate)

        return skip("predicate evaluated to true: %s" % desc)