#NEWLINE# def test_piping( ) : #NEWLINE# #INDENT# '\n    Verify that piping several commands together behaves as expected.\n    ' #NEWLINE# cmd_ls = clom . ls . with_opts ( '-lah' ) #NEWLINE# cmd_ls . _env = { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } #NEWLINE# cmd_echo = clom . echo . with_opts ( 'monkey' , 'gorilla' ) #NEWLINE# cmd_grep = clom . grep . with_opts ( 'monkey' ) #NEWLINE# ls_pipe_echo = cmd_ls . pipe_to ( cmd_echo ) #NEWLINE# ls_pipe_echo_expected = 'ls -lah | echo monkey gorilla' #NEWLINE# assert ( ls_pipe_echo_expected == str ( ls_pipe_echo ) ) #NEWLINE# ls_pipe_echo = ( cmd_ls | cmd_echo ) #NEWLINE# assert ( ls_pipe_echo_expected == str ( ls_pipe_echo ) ) #NEWLINE# ls_pipe_echo_pipe_grep = ls_pipe_echo . pipe_to ( cmd_grep ) #NEWLINE# ls_pipe_echo_pipe_grep_expected = ( ls_pipe_echo_expected + ' | grep monkey' ) #NEWLINE# assert ( ls_pipe_echo_pipe_grep_expected == str ( ls_pipe_echo_pipe_grep ) ) #NEWLINE# ls_pipe_echo_pipe_grep = ( ls_pipe_echo | cmd_grep ) #NEWLINE# assert ( ls_pipe_echo_pipe_grep_expected == str ( ls_pipe_echo_pipe_grep ) )