def _helper_parses_correctly(
    additional_argv,
    expected_args,
    mock_exit,
    mock_help,
    mock_error
):
    """
    Helper method for assertions about successful argument parsing.
    """
    # For convenience, we will always include a default program here. This
    # saves callers from appending a program to all of their additional_argv,
    # and it is assumed that the special casing for when a program is passed vs
    # not will be handled elsewhere. This is a helper for asserting that our
    # calling API is as expected.
    #
    # It isn't clear if the ArgumentParser object is supposed to expose the
    # fact that it calls sys.argv for testing. We might be breaking
    # encapsulation of the API a bit, but it facilitates our own API testing
    # enough that it seems like a reasonable risk.
    default_program = 'du'
    argv = ['eg'] + additional_argv + [default_program]

    with patch('sys.argv', new=argv):
        actual_args = core._parse_arguments()
        assert actual_args.config_file == expected_args.config_file
        assert actual_args.custom_dir == expected_args.custom_dir
        assert actual_args.examples_dir == expected_args.examples_dir
        assert actual_args.list == expected_args.list
        assert actual_args.pager_cmd == expected_args.pager_cmd
        assert actual_args.use_color == expected_args.use_color
        assert actual_args.squeeze == expected_args.squeeze
        assert actual_args.version == expected_args.version
        assert actual_args.edit == expected_args.edit
        # Note that here we use the default, as described above.
        assert actual_args.program == default_program

        # Now make sure we didn't call any other parser methods
        assert mock_exit.call_args_list == []
        assert mock_help.call_args_list == []
        assert mock_error.call_args_list == []

    Helper method for assertions about successful argument parsing.
    
test/core_test.py