# Buggy code
def __init__(
    self,
    command,
    parent=None,
    info_name=None,
    obj=None,
    auto_envvar_prefix=None,
    default_map=None,
    terminal_width=None,
    max_content_width=None,
    resilient_parsing=False,
    allow_extra_args=None,
    allow_interspersed_args=None,
    ignore_unknown_options=None,
    help_option_names=None,
    token_normalize_func=None,
    color=None,
):
    #: the parent context or `None` if none exists.
    self.parent = parent
    #: the :class:`Command` for this context.
    self.command = command
    #: the descriptive information name
    self.info_name = info_name
    #: the parsed parameters except if the value is hidden in which
    #: case it's not remembered.
    self.params = {}
    #: the leftover arguments.
    self.args = []
    #: protected arguments.  These are arguments that are prepended
    #: to `args` when certain parsing scenarios are encountered but
    #: must be never propagated to another arguments.  This is used
    #: to implement nested parsing.
    self.protected_args = []
    if obj is None and parent is not None:
        obj = parent.obj
    #: the user object stored.
    self.obj = obj
    self._meta = getattr(parent, "meta", {})

    #: A dictionary (-like object) with defaults for parameters.
    if default_map is None and parent is not None and parent.default_map is not None:
        default_map = parent.default_map.get(info_name)
    self.default_map = default_map

    #: This flag indicates if a subcommand is going to be executed. A
    #: group callback can use this information to figure out if it's
    #: being executed directly or because the execution flow passes
    #: onwards to a subcommand. By default it's None, but it can be
    #: the name of the subcommand to execute.
    #:
    #: If chaining is enabled this will be set to ``'*'`` in case
    #: any commands are executed.  It is however not possible to
    #: figure out which ones.  If you require this knowledge you
    #: should use a :func:`resultcallback`.
    self.invoked_subcommand = None

    if terminal_width is None and parent is not None:
        terminal_width = parent.terminal_width
    #: The width of the terminal (None is autodetection).
    self.terminal_width = terminal_width

    if max_content_width is None and parent is not None:
        max_content_width = parent.max_content_width
    #: The maximum width of formatted content (None implies a sensible
    #: default which is 80 for most things).
    self.max_content_width = max_content_width

    if allow_extra_args is None:
        allow_extra_args = command.allow_extra_args
    #: Indicates if the context allows extra args or if it should
    #: fail on parsing.
    #:
    #: .. versionadded:: 3.0
    self.allow_extra_args = allow_extra_args

    if allow_interspersed_args is None:
        allow_interspersed_args = command.allow_interspersed_args
    #: Indicates if the context allows mixing of arguments and
    #: options or not.
    #:
    #: .. versionadded:: 3.0
    self.allow_interspersed_args = allow_interspersed_args

    if ignore_unknown_options is None:
        ignore_unknown_options = command.ignore_unknown_options
    #: Instructs click to ignore options that a command does not
    #: understand and will store it on the context for later
    #: processing.  This is primarily useful for situations where you
    #: want to call into external programs.  Generally this pattern is
    #: strongly discouraged because it's not possibly to losslessly
    #: forward all arguments.
    #:
    #: .. versionadded:: 4.0
    self.ignore_unknown_options = ignore_unknown_options

    if help_option_names is None:
        if parent is not None:
            help_option_names = parent.help_option_names
        else:
            help_option_names = ["--help"]

    #: The names for the help options.
    self.help_option_names = help_option_names

    if token_normalize_func is None and parent is not None:
        token_normalize_func = parent.token_normalize_func

    #: An optional normalization function for tokens.  This is
    #: options, choices, commands etc.
    self.token_normalize_func = token_normalize_func

    #: Indicates if resilient parsing is enabled.  In that case Click
    #: will do its best to not cause any failures.
    self.resilient_parsing = resilient_parsing

    # If there is no envvar prefix yet, but the parent has one and
    # the command on this level has a name, we can expand the envvar
    # prefix automatically.
    if auto_envvar_prefix is None:
        if (
            parent is not None
            and parent.auto_envvar_prefix is not None
            and self.info_name is not None
        ):
            auto_envvar_prefix = "%s_%s" % (
                parent.auto_envvar_prefix,
                self.info_name.upper(),
            )
    else:
        self.auto_envvar_prefix = auto_envvar_prefix.upper()
    self.auto_envvar_prefix = auto_envvar_prefix

    if color is None and parent is not None:
        color = parent.color

    #: Controls if styling output is wanted or not.
    self.color = color

    self._close_callbacks = []
    self._depth = 0


# Traceback (AssertionError)
Traceback (most recent call last):
File "test_compl.py", line 19, in <module>
test_argument_choice()
File "test_compl.py", line 14, in test_argument_choice
assert list(get_choices(cli, 'lol', ['arg11'], '')) == ['arg21', 'arg22']
AssertionError

# Fixed code
def __init__(
    self,
    command,
    parent=None,
    info_name=None,
    obj=None,
    auto_envvar_prefix=None,
    default_map=None,
    terminal_width=None,
    max_content_width=None,
    resilient_parsing=False,
    allow_extra_args=None,
    allow_interspersed_args=None,
    ignore_unknown_options=None,
    help_option_names=None,
    token_normalize_func=None,
    color=None,
):
    #: the parent context or `None` if none exists.
    self.parent = parent
    #: the :class:`Command` for this context.
    self.command = command
    #: the descriptive information name
    self.info_name = info_name
    #: the parsed parameters except if the value is hidden in which
    #: case it's not remembered.
    self.params = {}
    #: the leftover arguments.
    self.args = []
    #: protected arguments.  These are arguments that are prepended
    #: to `args` when certain parsing scenarios are encountered but
    #: must be never propagated to another arguments.  This is used
    #: to implement nested parsing.
    self.protected_args = []
    if obj is None and parent is not None:
        obj = parent.obj
    #: the user object stored.
    self.obj = obj
    self._meta = getattr(parent, "meta", {})

    #: A dictionary (-like object) with defaults for parameters.
    if default_map is None and parent is not None and parent.default_map is not None:
        default_map = parent.default_map.get(info_name)
    self.default_map = default_map

    #: This flag indicates if a subcommand is going to be executed. A
    #: group callback can use this information to figure out if it's
    #: being executed directly or because the execution flow passes
    #: onwards to a subcommand. By default it's None, but it can be
    #: the name of the subcommand to execute.
    #:
    #: If chaining is enabled this will be set to ``'*'`` in case
    #: any commands are executed.  It is however not possible to
    #: figure out which ones.  If you require this knowledge you
    #: should use a :func:`resultcallback`.
    self.invoked_subcommand = None

    if terminal_width is None and parent is not None:
        terminal_width = parent.terminal_width
    #: The width of the terminal (None is autodetection).
    self.terminal_width = terminal_width

    if max_content_width is None and parent is not None:
        max_content_width = parent.max_content_width
    #: The maximum width of formatted content (None implies a sensible
    #: default which is 80 for most things).
    self.max_content_width = max_content_width

    if allow_extra_args is None:
        allow_extra_args = command.allow_extra_args
    #: Indicates if the context allows extra args or if it should
    #: fail on parsing.
    #:
    #: .. versionadded:: 3.0
    self.allow_extra_args = allow_extra_args

    if allow_interspersed_args is None:
        allow_interspersed_args = command.allow_interspersed_args
    #: Indicates if the context allows mixing of arguments and
    #: options or not.
    #:
    #: .. versionadded:: 3.0
    self.allow_interspersed_args = allow_interspersed_args

    if ignore_unknown_options is None:
        ignore_unknown_options = command.ignore_unknown_options
    #: Instructs click to ignore options that a command does not
    #: understand and will store it on the context for later
    #: processing.  This is primarily useful for situations where you
    #: want to call into external programs.  Generally this pattern is
    #: strongly discouraged because it's not possibly to losslessly
    #: forward all arguments.
    #:
    #: .. versionadded:: 4.0
    self.ignore_unknown_options = ignore_unknown_options

    if help_option_names is None:
        if parent is not None:
            help_option_names = parent.help_option_names
        else:
            help_option_names = ["--help"]

    #: The names for the help options.
    self.help_option_names = help_option_names

    if token_normalize_func is None and parent is not None:
        token_normalize_func = parent.token_normalize_func

    #: An optional normalization function for tokens.  This is
    #: options, choices, commands etc.
    self.token_normalize_func = token_normalize_func

    #: Indicates if resilient parsing is enabled.  In that case Click
    #: will do its best to not cause any failures and default values
    #: will be ignored. Useful for completion.
    self.resilient_parsing = resilient_parsing

    # If there is no envvar prefix yet, but the parent has one and
    # the command on this level has a name, we can expand the envvar
    # prefix automatically.
    if auto_envvar_prefix is None:
        if (
            parent is not None
            and parent.auto_envvar_prefix is not None
            and self.info_name is not None
        ):
            auto_envvar_prefix = "%s_%s" % (
                parent.auto_envvar_prefix,
                self.info_name.upper(),
            )
    else:
        self.auto_envvar_prefix = auto_envvar_prefix.upper()
    self.auto_envvar_prefix = auto_envvar_prefix

    if color is None and parent is not None:
        color = parent.color

    #: Controls if styling output is wanted or not.
    self.color = color

    self._close_callbacks = []
    self._depth = 0