Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added Uncommon Typos #1429

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Added Uncommon Typos #1429

wants to merge 2 commits into from

Conversation

preetham1239
Copy link

A pull request for the changes in #883

Copy link
Collaborator

@scorphus scorphus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your PR, @preetham1239! Please, consider my suggestions below.

Comment on lines 60 to 81
@pytest.mark.parametrize('script, output', [
('git lock', "git: lock is not a git command. See 'git --help'. \n\n The most similar command is \n log"),
('git lock --help', "git: lock is not a git command. See 'git --help'. \n\n The most similar command is \n log")])
def test_match_uncommon(output, script):
assert match(Command(script, output))


@pytest.mark.parametrize('script', [
'git branch foo',
'git checkout feature/test_commit',
'git push'])
def test_not_match_uncommon(script):
assert not match(Command(script, ''))


@pytest.mark.parametrize('script, expected_output', [
('git lock', ['git log']),
('git lock --help', ['git log --help'])])
def test_get_new_command_uncommon(script, expected_output):
output = "git: '{}' is not a git command. See 'git --help'.".format(script.split()[1])
command = Command(script, output)
assert get_new_command(command) == expected_output
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These test cases should be added to the existing test functions.

if broken_cmd in COMMON_TYPOS:
matched = COMMON_TYPOS[broken_cmd]
else:
matched = get_all_matched_commands(command.output, ['The most similar command', 'Did you mean'])
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We still want to suggest similar commands. Hence the call to extend in my suggestion.

@preetham1239
Copy link
Author

Got it. Will make those changes.

@preetham1239
Copy link
Author

I added the test cases to the existing functions and extended the matched commands list.

@preetham1239
Copy link
Author

Hey @scorphus, I wanted to follow up on the pull request I submitted. As this is my first contribution to an open-source project, I'm quite eager to see it through. I understand you might be busy, but if you could take a moment to review the changes I've made, it would mean a lot to me.

I'm looking forward to any further suggestions you might have.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants