

def test_can_mix_options_and_commands(index_data):
    index_data['aws']['arguments'] = ['--no-validate-ssl']
    index_data['aws']['commands'] = ['ec2']
    index_data['aws']['children'] = {
        'ec2': {
            'argument_metadata': {
                
            },
            'arguments': ['--query-ec2', '--instance-id'],
            'commands': ['create-tags', 'describe-instances'],
            'children': {
                
            },
        },
    }
    completer = AWSCLIModelCompleter(index_data)
    c = completer.autocomplete
    partial_cmd = 'ec2 --no-validate-ssl'
    for i in range(1, len(partial_cmd)):
        c(partial_cmd[:i])
    assert (c('ec2 --no-validate-ssl ') == ['create-tags', 'describe-instances'])
    c('ec2 --no-validate-ssl c')
    c('ec2 --no-validate-ssl cr')
    c('ec2 --no-validate-ssl cre')
    c('ec2 --no-validate-ssl crea')
    assert (c('ec2 --no-validate-ssl creat') == ['create-tags'])

dataset/ETHPy150Open awslabs/aws-shell/tests/unit/test_autocomplete.py test_can_mix_options_and_commands/original