Example #1
0
def test_chain_with_functions():
    """util.chain works with functions"""
    def ten(data):
        return 10

    def mult_by_2(data):
        return data * 2.0

    def divide_by_4(data):
        return data / 4.0

    result = util.chain(ten, mult_by_2, divide_by_4)
    assert_equals(result, 5)
Example #2
0
def test_chain_with_functions():
    """util.chain works with functions"""

    def ten(data):
        return 10

    def mult_by_2(data):
        return data * 2.0

    def divide_by_4(data):
        return data / 4.0

    result = util.chain(ten, mult_by_2, divide_by_4)
    assert_equals(result, 5)
Example #3
0
def test_chain_with_lambdas():
    """util.chain works with lambdas"""
    result = util.chain(lambda result: 5, lambda result: result * 2)
    assert_equals(result, 10)