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)
def test_huge_input(): wc = compose(join, cmd('wc -l')) eq_(wc('%d\n' % x for x in range(10000)), '10000\n')
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'))
def __or__(self, other): return Fun(compose(other, self))