def test_call_with_parser_error(mock_sub, capsys):
    'Parser errors on output from check_output.'
    with pytest.raises(CommandOutputParseError, match='Unable to parse command output: Input does not contain 3 lines'):
        mock_sub.parse_output(third_line_parser, ['hello', 'world'])
    mock_sub._subprocess.check_output.assert_called_with(['hello', 'world'], text=True)
    expected_output = '\nCommand Output Parsing Error:\n    Input does not contain 3 lines\nCommand:\n    hello world\nCommand Output:\n    some output line 1\n    more output line 2\n'
    assert (capsys.readouterr().out == expected_output)
Parser errors on output from check_output.
def test_call_with_parser_error(mock_sub, capsys):
    
    with pytest.raises(CommandOutputParseError, match='Unable to parse command output: Input does not contain 3 lines'):
        mock_sub.parse_output(third_line_parser, ['hello', 'world'])
    mock_sub._subprocess.check_output.assert_called_with(['hello', 'world'], text=True)
    expected_output = '\nCommand Output Parsing Error:\n    Input does not contain 3 lines\nCommand:\n    hello world\nCommand Output:\n    some output line 1\n    more output line 2\n'
    assert (capsys.readouterr().out == expected_output)