def test_get_config_tuple_from_egrc_when_present(mock_expand):
    """
    Make sure we extract values correctly from the egrc.
    """
    # These are the values hardcoded into the files.
    egrc_examples_dir = 'test/example/dir/in/egrc_withdata'
    egrc_custom_dir = 'test/custom/dir/in/egrc_withdata'
    egrc_use_color = True
    egrc_pager_cmd = 'more egrc'
    egrc_editor_cmd = 'vim egrc'
    color_config_from_file = _get_color_config_from_egrc_withdata()
    egrc_squeeze = True
    # Order matters--we apply substitutions alphabetically.
    egrc_subs = [
        substitute.Substitution(r'    ', r'', False),
        substitute.Substitution('\n\n\n', '\n\n', True)
    ]

    def return_expanded_path(*args, **kwargs):
        if args[0] == egrc_examples_dir:
            return egrc_examples_dir
        elif args[0] == egrc_custom_dir:
            return egrc_custom_dir
        else:
            raise TypeError(
                args[0] +
                ' was an unexpected path--should be ' +
                egrc_examples_dir +
                ' or ' +
                egrc_custom_dir
            )

    mock_expand.side_effect = return_expanded_path

    actual = config.get_config_tuple_from_egrc(PATH_EGRC_WITH_DATA)

    expected = config.Config(
        examples_dir=egrc_examples_dir,
        custom_dir=egrc_custom_dir,
        color_config=color_config_from_file,
        use_color=egrc_use_color,
        pager_cmd=egrc_pager_cmd,
        squeeze=egrc_squeeze,
        subs=egrc_subs,
        editor_cmd=egrc_editor_cmd,
    )

    assert actual == expected

    mock_expand.assert_any_call(egrc_examples_dir)
    mock_expand.assert_any_call(egrc_custom_dir)

    Make sure we extract values correctly from the egrc.
    
test/config_test.py