예제 #1
0
def test_run_output():
    eq_(''.join(run(cmd('echo foo'))), 'foo\n')
    eq_(run(compose(join, cmd('echo foo'))), 'foo\n')
    eq_(call(cmd('echo foo')), 0)
예제 #2
0
def test_huge_input():
    wc = compose(join, cmd('wc -l'))
    eq_(wc('%d\n' % x for x in range(10000)), '10000\n')
예제 #3
0
def test_cmd():
    text = six.u('привет, λ!\nλx. x\nдо свидания\n')
    regexp = six.u('λ[a-zA-Z]\.')
    grep = compose(join, cmd('grep {}', regexp))
    eq_(grep(text), six.u('λx. x\n'))
예제 #4
0
 def __or__(self, other):
     return Fun(compose(other, self))