Пример #1
0
def test_compose():
    with Assert.raises(TypeError):
        compose()
    add_one = lambda x: x + 1
    mul_two = lambda x: x * 2
    Assert(compose(add_one, mul_two)(1)) == 3

    func = lambda: None
    Assert(compose(func)).is_(func)
Пример #2
0
def test_compose():
    with Assert.raises(TypeError):
        compose()
    add_one = lambda x: x + 1
    mul_two = lambda x: x * 2
    Assert(compose(add_one, mul_two)(1)) == 3

    func = lambda: None
    Assert(compose(func)).is_(func)
Пример #3
0
 def get_participants(e):
     participants = e['ATTENDEE']
     if type(participants) != list:
         participants = participants,
     if len(participants):
         people = map(compose(partial(add, ' ' * 4), unmailto, unicode),
                      participants)
         return u'\nParticipants:\n%s' % u'\n'.join(people)
     else:
         return None