repo_id stringclasses 409
values | prefix large_stringlengths 34 36.3k | target large_stringlengths 1 498 | assertion_type stringclasses 31
values | difficulty stringclasses 8
values | test_file stringlengths 10 121 | test_function stringlengths 1 104 | test_class stringlengths 0 51 | lineno int32 2 11.3k | commit_idx int32 |
|---|---|---|---|---|---|---|---|---|---|
nvbn/thefuck | import pytest
from thefuck.rules.apt_upgrade import get_new_command, match
from thefuck.types import Command
match_output = '''
Listing... Done
heroku/stable 6.15.2-1 amd64 [upgradable from: 6.14.43-1]
resolvconf/zesty-updates,zesty-updates 1.79ubuntu4.1 all [upgradable from: 1.79ubuntu4]
squashfs-tools/zesty-updates ... | 'apt upgrade' | assert | string_literal | tests/rules/test_apt_upgrade.py | test_get_new_command | 33 | null | |
nvbn/thefuck | from thefuck.rules.docker_image_being_used_by_container import match, get_new_command
from thefuck.types import Command
def test_get_new_command():
err_response = """
Error response from daemon: conflict: unable to delete cd809b04b6ff (cannot be forced) - image
is being used by running container e5... | expected | assert | variable | tests/rules/test_docker_image_being_used_by_container.py | test_get_new_command | 27 | null | |
nvbn/thefuck | import pytest
from thefuck.rules.git_not_command import match, get_new_command
from thefuck.types import Command
def git_not_command():
return """git: 'brnch' is not a git command. See 'git --help'.
The most similar command is
branch
"""
def git_not_command_one_of_this():
return """git: 'st' is not a git com... | ['git branch'] | assert | collection | tests/rules/test_git_not_command.py | test_get_new_command | 52 | null | |
nvbn/thefuck | import pytest
from thefuck.types import Command
from thefuck.rules.brew_uninstall import get_new_command, match
def output():
return ("Uninstalling /usr/local/Cellar/tbb/4.4-20160916... (118 files, 1.9M)\n"
"tbb 4.4-20160526, 4.4-20160722 are still installed.\n"
"Remove all versions with `b... | new_command | assert | variable | tests/rules/test_brew_uninstall.py | test_get_new_command | 31 | null | |
nvbn/thefuck | import os
import pytest
from thefuck.rules.ssh_known_hosts import match, get_new_command, \
side_effect
from thefuck.types import Command
def ssh_error(tmpdir):
path = os.path.join(str(tmpdir), 'known_hosts')
def reset(path):
with open(path, 'w') as fh:
lines = [
'123.2... | 'ssh user@host' | assert | string_literal | tests/rules/test_ssh_known_host.py | test_get_new_command | 66 | null | |
nvbn/thefuck | import pytest
from thefuck.rules.npm_wrong_command import match, get_new_command
from thefuck.types import Command
output = '''
Usage: npm <command>
where <command> is one of:
access, add-user, adduser, apihelp, author, bin, bugs, c,
cache, completion, config, ddp, dedupe, deprecate, dist-tag,
dist-tags, ... | result | assert | variable | tests/rules/test_npm_wrong_command.py | test_get_new_command | 58 | null | |
nvbn/thefuck | import pytest
from thefuck.const import ARGUMENT_PLACEHOLDER
from thefuck.shells import Fish
class TestFish(object):
def shell(self):
return Fish()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.fish.Popen')
mock.return_value.stdout.read.side_effect = [(
b'cd... | shell.app_alias('fuck') | assert | func_call | tests/shells/test_fish.py | test_app_alias | TestFish | 80 | null |
nvbn/thefuck | from thefuck.rules.ls_all import match, get_new_command
from thefuck.types import Command
def test_get_new_command():
assert get_new_command(Command('ls empty_dir', '')) == | 'ls -A empty_dir' | assert | string_literal | tests/rules/test_ls_all.py | test_get_new_command | 11 | null | |
nvbn/thefuck | import pytest
from itertools import islice
from thefuck import ui
from thefuck.types import CorrectedCommand
from thefuck import const
def patch_get_key(monkeypatch):
def patch(vals):
vals = iter(vals)
monkeypatch.setattr('thefuck.ui.get_key', lambda: next(vals))
return patch
class TestSelect... | ('', 'No fucks given\n') | assert | collection | tests/test_ui.py | test_without_commands | TestSelectCommand | 67 | null |
nvbn/thefuck | import pytest
from thefuck.shells import Generic
class TestGeneric(object):
def shell(self):
return Generic()
def test_from_shell(self, shell):
assert shell.from_shell('pwd') == | 'pwd' | assert | string_literal | tests/shells/test_generic.py | test_from_shell | TestGeneric | 13 | null |
nvbn/thefuck | import pytest
from thefuck.shells import Generic
class TestGeneric(object):
def shell(self):
return Generic()
@pytest.mark.parametrize('side_effect, expected_info, warn', [
([u'3.5.9'], u'Generic Shell 3.5.9', False),
([OSError], u'Generic Shell', True),
])
def test_info(self,... | warn | assert | variable | tests/shells/test_generic.py | test_info | TestGeneric | 55 | null |
nvbn/thefuck | import pytest
from thefuck.const import ARGUMENT_PLACEHOLDER
from thefuck.shells import Fish
class TestFish(object):
def shell(self):
return Fish()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.fish.Popen')
mock.return_value.stdout.read.side_effect = [(
b'cd... | exception) | pytest.raises | variable | tests/shells/test_fish.py | test_get_version_error | TestFish | 133 | null |
nvbn/thefuck | import pytest
from tests.utils import Rule, CorrectedCommand
from thefuck import corrector, const
from thefuck.system import Path
from thefuck.types import Command
from thefuck.corrector import get_corrected_commands, organize_commands
def glob(mocker):
results = {}
mocker.patch('thefuck.system.Path.glob',
... | set(names) | assert | func_call | tests/test_corrector.py | _compare_names | TestGetRules | 26 | null |
nvbn/thefuck | from thefuck.rules.ls_all import match, get_new_command
from thefuck.types import Command
def test_get_new_command():
assert get_new_command(Command('ls empty_dir', '')) == 'ls -A empty_dir'
assert get_new_command(Command('ls', '')) == | 'ls -A' | assert | string_literal | tests/rules/test_ls_all.py | test_get_new_command | 12 | null | |
nvbn/thefuck | import pytest
from thefuck.shells.tcsh import Tcsh
class TestTcsh(object):
def shell(self):
return Tcsh()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.tcsh.Popen')
mock.return_value.stdout.read.return_value = (
b'fuck\teval $(thefuck $(fc -ln -1))\n'
... | 'pwd' | assert | string_literal | tests/shells/test_tcsh.py | test_to_shell | TestTcsh | 32 | null |
nvbn/thefuck | import os
import pytest
from thefuck.shells.zsh import Zsh
class TestZsh(object):
def shell(self):
return Zsh()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.zsh.Popen')
return mock
def shell_aliases(self):
os.environ['TF_SHELL_ALIASES'] = (
'fu... | OSError) | pytest.raises | variable | tests/shells/test_zsh.py | test_get_version_error | TestZsh | 83 | null |
nvbn/thefuck | import os
import pytest
from thefuck.shells import Bash
class TestBash(object):
def shell(self):
return Bash()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.bash.Popen')
return mock
def shell_aliases(self):
os.environ['TF_SHELL_ALIASES'] = (
'al... | 'pwd' | assert | string_literal | tests/shells/test_bash.py | test_to_shell | TestBash | 36 | null |
nvbn/thefuck | import pytest
from thefuck.specific.git import git_support
from thefuck.types import Command
@pytest.mark.parametrize('called, command, output', [
('git co', 'git checkout', "19:22:36.299340 git.c:282 trace: alias expansion: co => 'checkout'"),
('git com file', 'git commit --verbose file',
"19:23:25.470... | command | assert | variable | tests/specific/test_git.py | test_git_support | 19 | null | |
nvbn/thefuck | import pytest
from thefuck.const import ARGUMENT_PLACEHOLDER
from thefuck.shells import Fish
class TestFish(object):
def shell(self):
return Fish()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.fish.Popen')
mock.return_value.stdout.read.side_effect = [(
b'cd... | 'foo; and bar' | assert | string_literal | tests/shells/test_fish.py | test_and_ | TestFish | 58 | null |
nvbn/thefuck | import pytest
from thefuck.types import Command
from thefuck.rules.brew_link import get_new_command, match
def output():
return ("Error: Could not symlink bin/gcp\n"
"Target /usr/local/bin/gcp\n"
"already exists. You may want to remove it:\n"
" rm '/usr/local/bin/gcp'\n"
... | new_command | assert | variable | tests/rules/test_brew_link.py | test_get_new_command | 37 | null | |
nvbn/thefuck | from io import BytesIO
import pytest
from thefuck.rules.yum_invalid_operation import match, get_new_command, _get_operations
from thefuck.types import Command
yum_help_text = '''Loaded plugins: extras_suggestions, langpacks, priorities, update-motd
Usage: yum [options] COMMAND
List of Commands:
check Chec... | result | assert | variable | tests/rules/test_yum_invalid_operation.py | test_get_new_command | 173 | null | |
nvbn/thefuck | import os
from subprocess import PIPE, STDOUT
from mock import Mock
import pytest
from tests.utils import CorrectedCommand, Rule
from thefuck import const
from thefuck.exceptions import EmptyCommand
from thefuck.system import Path
from thefuck.types import Command
class TestRule(object):
def test_from_path_rule_ex... | None | assert | none_literal | tests/test_types.py | test_from_path_rule_exception | TestRule | 51 | null |
nvbn/thefuck | import pytest
from thefuck.rules.git_pull_clone import match, get_new_command
from thefuck.types import Command
git_err = '''
fatal: Not a git repository (or any parent up to mount point /home)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
'''
@pytest.mark.parametrize('command, output', [... | output | assert | variable | tests/rules/test_git_pull_clone.py | test_get_new_command | 21 | null | |
nvbn/thefuck | import pytest
from io import BytesIO
from thefuck.rules.go_unknown_command import match, get_new_command
from thefuck.types import Command
def build_misspelled_output():
return '''go bulid: unknown command
Run 'go help' for usage.'''
def go_stderr(mocker):
stderr = b'''Go is a tool for managing Go source code... | 'go build' | assert | string_literal | tests/rules/test_go_unknown_command.py | test_get_new_command | 82 | null | |
nvbn/thefuck | from io import BytesIO
import pytest
from thefuck.types import Command
from thefuck.rules.grunt_task_not_found import match, get_new_command
output = '''
Warning: Task "{}" not found. Use --force to continue.
Aborted due to warnings.
Execution Time (2016-08-13 21:01:40 UTC+3)
loading tasks 11ms ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇... | result | assert | variable | tests/rules/test_grunt_task_not_found.py | test_get_new_command | 129 | null | |
nvbn/thefuck | import os
import pytest
from thefuck.shells import Bash
class TestBash(object):
def shell(self):
return Bash()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.bash.Popen')
return mock
def shell_aliases(self):
os.environ['TF_SHELL_ALIASES'] = (
'al... | 'ls || cd' | assert | string_literal | tests/shells/test_bash.py | test_or_ | TestBash | 42 | null |
nvbn/thefuck | import pytest
import sys
from mock import Mock, patch
from psutil import AccessDenied, TimeoutExpired
from thefuck.output_readers import rerun
class TestRerun(object):
def setup_method(self, test_method):
self.patcher = patch('thefuck.output_readers.rerun.Process')
process_mock = self.patcher.star... | settings.wait_command) | assert_* | complex_expr | tests/output_readers/test_rerun.py | test_wait_output_is_not_slow | TestRerun | 47 | null |
nvbn/thefuck | import pytest
from thefuck.shells import Generic
class TestGeneric(object):
def shell(self):
return Generic()
def test_and_(self, shell):
assert shell.and_('ls', 'cd') == | 'ls && cd' | assert | string_literal | tests/shells/test_generic.py | test_and_ | TestGeneric | 19 | null |
nvbn/thefuck | import pytest
from thefuck.rules.cp_omitting_directory import match, get_new_command
from thefuck.types import Command
def test_get_new_command():
assert get_new_command(Command('cp dir', '')) == | 'cp -a dir' | assert | string_literal | tests/rules/test_cp_omitting_directory.py | test_get_new_command | 22 | null | |
nvbn/thefuck | import pytest
from thefuck.types import Command
from thefuck.rules.git_bisect_usage import match, get_new_command
def output():
return ("usage: git bisect [help|start|bad|good|new|old"
"|terms|skip|next|reset|visualize|replay|log|run]")
@pytest.mark.parametrize('script, new_cmd, ', [
('git bisect ... | new_cmd | assert | variable | tests/rules/test_git_bisect_usage.py | test_get_new_command | 30 | null | |
nvbn/thefuck | import pytest
from mock import Mock
from thefuck.entrypoints.fix_command import _get_raw_command
class TestGetRawCommand(object):
def test_from_force_command_argument(self):
known_args = Mock(force_command='git brunch')
assert _get_raw_command(known_args) == | ['git brunch'] | assert | collection | tests/entrypoints/test_fix_command.py | test_from_force_command_argument | TestGetRawCommand | 9 | null |
nvbn/thefuck | import pytest
from thefuck.const import ARGUMENT_PLACEHOLDER
from thefuck.shells import Fish
class TestFish(object):
def shell(self):
return Fish()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.fish.Popen')
mock.return_value.stdout.read.side_effect = [(
b'cd... | shell.app_alias('FUCK') | assert | func_call | tests/shells/test_fish.py | test_app_alias | TestFish | 81 | null |
nvbn/thefuck | from io import BytesIO
import pytest
from thefuck.types import Command
from thefuck.rules.apt_invalid_operation import match, get_new_command, \
_get_operations
invalid_operation = 'E: Invalid operation {}'.format
apt_help = b'''apt 1.0.10.2ubuntu1 for amd64 compiled on Oct 5 2015 15:55:05
Usage: apt [options] co... | result | assert | variable | tests/rules/test_apt_invalid_operation.py | test_get_new_command | 164 | null | |
nvbn/thefuck | import pytest
from thefuck.rules.history import match, get_new_command
from thefuck.types import Command
def history_without_current(mocker):
return mocker.patch(
'thefuck.rules.history.get_valid_history_without_current',
return_value=['ls cat', 'diff x'])
@pytest.mark.parametrize('script, result'... | result | assert | variable | tests/rules/test_history.py | test_get_new_command | 27 | null | |
nvbn/thefuck | import pytest
from mock import Mock
from thefuck.entrypoints.fix_command import _get_raw_command
class TestGetRawCommand(object):
def test_from_command_argument(self, os_environ):
os_environ['TF_HISTORY'] = None
known_args = Mock(force_command=None,
command=['sl'])
... | ['sl'] | assert | collection | tests/entrypoints/test_fix_command.py | test_from_command_argument | TestGetRawCommand | 15 | null |
nvbn/thefuck | import pytest
from thefuck.rules.missing_space_before_subcommand import (
match, get_new_command)
from thefuck.types import Command
def all_executables(mocker):
return mocker.patch(
'thefuck.rules.missing_space_before_subcommand.get_all_executables',
return_value=['git', 'ls', 'npm', 'w', 'watc... | result | assert | variable | tests/rules/test_missing_space_before_subcommand.py | test_get_new_command | 31 | null | |
nvbn/thefuck | import pytest
from thefuck.const import ARGUMENT_PLACEHOLDER
from thefuck.shells import Fish
class TestFish(object):
def shell(self):
return Fish()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.fish.Popen')
mock.return_value.stdout.read.side_effect = [(
b'cd... | 'pwd' | assert | string_literal | tests/shells/test_fish.py | test_to_shell | TestFish | 55 | null |
nvbn/thefuck | import pytest
from thefuck.const import ARGUMENT_PLACEHOLDER
from thefuck.shells import Fish
class TestFish(object):
def shell(self):
return Fish()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.fish.Popen')
mock.return_value.stdout.read.side_effect = [(
b'cd... | 'foo; or bar' | assert | string_literal | tests/shells/test_fish.py | test_or_ | TestFish | 61 | null |
nvbn/thefuck | import os
import pytest
from thefuck.shells import Bash
class TestBash(object):
def shell(self):
return Bash()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.bash.Popen')
return mock
def shell_aliases(self):
os.environ['TF_SHELL_ALIASES'] = (
'al... | shell.app_alias('fuck') | assert | func_call | tests/shells/test_bash.py | test_app_alias | TestBash | 51 | null |
nvbn/thefuck | import pytest
import warnings
from mock import Mock, call, patch
from thefuck.utils import default_settings, \
memoize, get_closest, get_all_executables, replace_argument, \
get_all_matched_commands, is_app, for_app, cache, \
get_valid_history_without_current, _cache, get_close_matches
from thefuck.types im... | result | assert | variable | tests/test_utils.py | test_replace_argument | 115 | null | |
nvbn/thefuck | import pytest
from thefuck.shells.tcsh import Tcsh
class TestTcsh(object):
def shell(self):
return Tcsh()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.tcsh.Popen')
mock.return_value.stdout.read.return_value = (
b'fuck\teval $(thefuck $(fc -ln -1))\n'
... | ['ls', 'rm'] | assert | collection | tests/shells/test_tcsh.py | test_get_history | TestTcsh | 54 | null |
nvbn/thefuck | import pytest
from thefuck.rules.conda_mistype import match, get_new_command
from thefuck.types import Command
def mistype_response():
return """
CommandNotFoundError: No command 'conda lst'.
Did you mean 'conda list'?
"""
def test_get_new_command(mistype_response):
assert (get_new_command(Command('co... | ['conda list'] | assert | collection | tests/rules/test_conda_mistype.py | test_get_new_command | 24 | null | |
nvbn/thefuck | import pytest
import warnings
from mock import Mock, call, patch
from thefuck.utils import default_settings, \
memoize, get_closest, get_all_executables, replace_argument, \
get_all_matched_commands, is_app, for_app, cache, \
get_valid_history_without_current, _cache, get_close_matches
from thefuck.types im... | 2 | assert | numeric_literal | tests/test_utils.py | test_no_memoize | 38 | null | |
nvbn/thefuck | import pytest
from thefuck.shells import Generic
class TestGeneric(object):
def shell(self):
return Generic()
def test_app_alias(self, shell):
assert 'alias fuck' in shell.app_alias('fuck')
assert 'alias FUCK' in | shell.app_alias('FUCK') | assert | func_call | tests/shells/test_generic.py | test_app_alias | TestGeneric | 29 | null |
nvbn/thefuck | import pytest
from six import BytesIO
from thefuck.rules.gem_unknown_command import match, get_new_command
from thefuck.types import Command
output = '''
ERROR: While executing gem ... (Gem::CommandLineError)
Unknown command {}
'''
gem_help_commands_stdout = b'''
GEM commands are:
build Build a ... | result | assert | variable | tests/rules/test_gem_unknown_command.py | test_get_new_command | 82 | null | |
nvbn/thefuck | import pytest
from thefuck.rules.no_command import match, get_new_command
from thefuck.types import Command
def get_all_executables(mocker):
mocker.patch('thefuck.rules.no_command.get_all_executables',
return_value=['vim', 'fsck', 'git', 'go', 'python'])
def history_without_current(mocker):
r... | result | assert | variable | tests/rules/test_no_command.py | test_get_new_command | 50 | null | |
nvbn/thefuck | import pytest
from thefuck.specific.git import git_support
from thefuck.types import Command
@pytest.mark.parametrize('command, is_git', [
('git pull', True),
('hub pull', True),
('git push --set-upstream origin foo', True),
('hub push --set-upstream origin foo', True),
('ls', False),
('cat git... | is_git | assert | variable | tests/specific/test_git.py | test_git_support_match | 36 | null | |
nvbn/thefuck | import pytest
from thefuck.types import Command
from thefuck.rules.brew_update_formula import get_new_command, match
output = ("Error: This command updates brew itself, and does not take formula"
" names.\nUse `brew upgrade thefuck`.")
@pytest.mark.parametrize('script, formula, ', [
('brew update foo', ... | new_command | assert | variable | tests/rules/test_brew_update_formula.py | test_get_new_command | 28 | null | |
nvbn/thefuck | import pytest
import warnings
from mock import Mock, call, patch
from thefuck.utils import default_settings, \
memoize, get_closest, get_all_executables, replace_argument, \
get_all_matched_commands, is_app, for_app, cache, \
get_valid_history_without_current, _cache, get_close_matches
from thefuck.types im... | {} | assert | collection | tests/test_utils.py | test_with_blank_cache | TestCache | 221 | null |
nvbn/thefuck | import pytest
import warnings
from mock import Mock, call, patch
from thefuck.utils import default_settings, \
memoize, get_closest, get_all_executables, replace_argument, \
get_all_matched_commands, is_app, for_app, cache, \
get_valid_history_without_current, _cache, get_close_matches
from thefuck.types im... | 'new-value' | assert | string_literal | tests/test_utils.py | test_with_filled_cache | TestCache | 228 | null |
nvbn/thefuck | import os
import pytest
from thefuck.shells.zsh import Zsh
class TestZsh(object):
def shell(self):
return Zsh()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.zsh.Popen')
return mock
def shell_aliases(self):
os.environ['TF_SHELL_ALIASES'] = (
'fu... | shell.app_alias('fuck') | assert | func_call | tests/shells/test_zsh.py | test_app_alias | TestZsh | 51 | null |
nvbn/thefuck | import pytest
from thefuck.rules.gradle_wrapper import match, get_new_command
from thefuck.types import Command
def exists(mocker):
return mocker.patch('thefuck.rules.gradle_wrapper.os.path.isfile',
return_value=True)
@pytest.mark.parametrize('script, result', [
('gradle assemble', './... | result | assert | variable | tests/rules/test_gradle_wrapper.py | test_get_new_command | 38 | null | |
nvbn/thefuck | import pytest
from thefuck import logs
@pytest.mark.usefixtures('no_colors')
@pytest.mark.parametrize('debug, stderr', [
(True, 'DEBUG: test\n'),
(False, '')])
def test_debug(capsys, settings, debug, stderr):
settings.debug = debug
logs.debug('test')
assert capsys.readouterr() == | ('', stderr) | assert | collection | tests/test_logs.py | test_debug | 19 | null | |
nvbn/thefuck | import os
import pytest
from thefuck.shells import Bash
class TestBash(object):
def shell(self):
return Bash()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.bash.Popen')
return mock
def shell_aliases(self):
os.environ['TF_SHELL_ALIASES'] = (
'al... | 'ls && cd' | assert | string_literal | tests/shells/test_bash.py | test_and_ | TestBash | 39 | null |
nvbn/thefuck | import pytest
from thefuck.const import ARGUMENT_PLACEHOLDER
from thefuck.shells import Fish
class TestFish(object):
def shell(self):
return Fish()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.fish.Popen')
mock.return_value.stdout.read.side_effect = [(
b'cd... | ['ls', 'rm'] | assert | collection | tests/shells/test_fish.py | test_get_history | TestFish | 102 | null |
nvbn/thefuck | import os
import pytest
from thefuck.shells.zsh import Zsh
class TestZsh(object):
def shell(self):
return Zsh()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.zsh.Popen')
return mock
def shell_aliases(self):
os.environ['TF_SHELL_ALIASES'] = (
'fu... | ['ls', 'rm'] | assert | collection | tests/shells/test_zsh.py | test_get_history | TestZsh | 66 | null |
nvbn/thefuck | import pytest
from thefuck.rules.unsudo import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('before, after', [
('sudo ls', 'ls'),
('sudo pacaur -S helloworld', 'pacaur -S helloworld')])
def test_get_new_command(before, after):
assert get_new_command(Command(before, '')... | after | assert | variable | tests/rules/test_unsudo.py | test_get_new_command | 22 | null | |
nvbn/thefuck | import os
import pytest
from thefuck.shells import Bash
class TestBash(object):
def shell(self):
return Bash()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.bash.Popen')
return mock
def shell_aliases(self):
os.environ['TF_SHELL_ALIASES'] = (
'al... | shell.app_alias('FUCK') | assert | func_call | tests/shells/test_bash.py | test_app_alias | TestBash | 52 | null |
nvbn/thefuck | import pytest
from thefuck.shells import Powershell
class TestPowershell(object):
def shell(self):
return Powershell()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.powershell.Popen')
return mock
def test_app_alias(self, shell):
assert 'function fuck' in sh... | shell.app_alias('FUCK') | assert | func_call | tests/shells/test_powershell.py | test_app_alias | TestPowershell | 23 | null |
nvbn/thefuck | import pytest
from tests.utils import Rule, CorrectedCommand
from thefuck import corrector, const
from thefuck.system import Path
from thefuck.types import Command
from thefuck.corrector import get_corrected_commands, organize_commands
def glob(mocker):
results = {}
mocker.patch('thefuck.system.Path.glob',
... | 'git.py') | assert_* | string_literal | tests/test_corrector.py | test_get_rules_rule_exception | 48 | null | |
nvbn/thefuck | from thefuck.rules.ls_lah import match, get_new_command
from thefuck.types import Command
def test_get_new_command():
assert get_new_command(Command('ls file.py', '')) == | 'ls -lah file.py' | assert | string_literal | tests/rules/test_ls_lah.py | test_get_new_command | 15 | null | |
nvbn/thefuck | import pytest
from io import BytesIO
from thefuck.rules.npm_run_script import match, get_new_command
from thefuck.types import Command
output = '''
Usage: npm <command>
where <command> is one of:
access, add-user, adduser, apihelp, author, bin, bugs, c,
cache, completion, config, ddp, dedupe, deprecate, dist-... | result | assert | variable | tests/rules/test_npm_run_script.py | test_get_new_command | 84 | null | |
nvbn/thefuck | import os
import pytest
from thefuck.shells import Bash
class TestBash(object):
def shell(self):
return Bash()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.bash.Popen')
return mock
def shell_aliases(self):
os.environ['TF_SHELL_ALIASES'] = (
'al... | alias | assert | variable | tests/shells/test_bash.py | test_app_alias_variables_correctly_set | TestBash | 58 | null |
nvbn/thefuck | import pytest
import warnings
from mock import Mock, call, patch
from thefuck.utils import default_settings, \
memoize, get_closest, get_all_executables, replace_argument, \
get_all_matched_commands, is_app, for_app, cache, \
get_valid_history_without_current, _cache, get_close_matches
from thefuck.types im... | None | assert | none_literal | tests/test_utils.py | test_without_fallback | TestGetClosest | 49 | null |
nvbn/thefuck | import pytest
from itertools import islice
from thefuck import ui
from thefuck.types import CorrectedCommand
from thefuck import const
def patch_get_key(monkeypatch):
def patch(vals):
vals = iter(vals)
monkeypatch.setattr('thefuck.ui.get_key', lambda: next(vals))
return patch
class TestSelect... | None | assert | none_literal | tests/test_ui.py | test_without_commands | TestSelectCommand | 66 | null |
nvbn/thefuck | import pytest
import six
import os
from mock import Mock
from thefuck import const
def load_source(mocker):
return mocker.patch('thefuck.conf.load_source')
class TestSettingsFromEnv(object):
def test_from_env(self, os_environ, settings):
os_environ.update({'THEFUCK_RULES': 'bash:lisp',
... | False | assert | bool_literal | tests/test_conf.py | test_from_env | TestSettingsFromEnv | 64 | null |
nvbn/thefuck | import pytest
from thefuck.rules.long_form_help import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize('before, after', [
('grep -h', 'grep --help'),
('tar -h', 'tar --help'),
('docker run -h', 'docker run --help'),
('cut -h', 'cut --help')])
def test_get_new_command(b... | after | assert | variable | tests/rules/test_long_form_help.py | test_get_new_command | 22 | null | |
nvbn/thefuck | import pytest
from thefuck.rules.ln_no_hard_link import match, get_new_command
from thefuck.types import Command
error = "hard link not allowed for directory"
@pytest.mark.parametrize('script, result', [
("ln barDir barLink", "ln -s barDir barLink"),
("sudo ln barDir barLink", "sudo ln -s barDir barLink"),
... | result | assert | variable | tests/rules/test_ln_no_hard_link.py | test_get_new_command | 37 | null | |
nvbn/thefuck | import pytest
from thefuck.shells import Generic
class TestGeneric(object):
def shell(self):
return Generic()
def test_get_aliases(self, shell):
assert shell.get_aliases() == | {} | assert | collection | tests/shells/test_generic.py | test_get_aliases | TestGeneric | 25 | null |
nvbn/thefuck | import os
from subprocess import PIPE, STDOUT
from mock import Mock
import pytest
from tests.utils import CorrectedCommand, Rule
from thefuck import const
from thefuck.exceptions import EmptyCommand
from thefuck.system import Path
from thefuck.types import Command
class TestCommand(object):
def Popen(self, monkey... | result | assert | variable | tests/test_types.py | test_from_script | TestCommand | 151 | null |
nvbn/thefuck | import pytest
import warnings
from mock import Mock, call, patch
from thefuck.utils import default_settings, \
memoize, get_closest, get_all_executables, replace_argument, \
get_all_matched_commands, is_app, for_app, cache, \
get_valid_history_without_current, _cache, get_close_matches
from thefuck.types im... | 'test' | assert | string_literal | tests/test_utils.py | test_with_blank_cache | TestCache | 222 | null |
nvbn/thefuck | from thefuck.rules.git_clone_git_clone import match, get_new_command
from thefuck.types import Command
output_clean = """
fatal: Too many arguments.
usage: git clone [<options>] [--] <repo> [<dir>]
"""
def test_get_new_command():
assert get_new_command(Command('git clone git clone foo', output_clean)) == | 'git clone foo' | assert | string_literal | tests/rules/test_git_clone_git_clone.py | test_get_new_command | 24 | null | |
nvbn/thefuck | import pytest
from thefuck.shells import Powershell
class TestPowershell(object):
def shell(self):
return Powershell()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.powershell.Popen')
return mock
def test_app_alias(self, shell):
assert 'function fuck' in | shell.app_alias('fuck') | assert | func_call | tests/shells/test_powershell.py | test_app_alias | TestPowershell | 22 | null |
nvbn/thefuck | import os
import pytest
from thefuck.shells.zsh import Zsh
class TestZsh(object):
def shell(self):
return Zsh()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.zsh.Popen')
return mock
def shell_aliases(self):
os.environ['TF_SHELL_ALIASES'] = (
'fu... | after | assert | variable | tests/shells/test_zsh.py | test_from_shell | TestZsh | 32 | null |
nvbn/thefuck | import pytest
from thefuck.rules.path_from_history import match, get_new_command
from thefuck.types import Command
def history(mocker):
return mocker.patch(
'thefuck.rules.path_from_history.get_valid_history_without_current',
return_value=['cd /opt/java', 'ls ~/work/project/'])
def path_exists(moc... | result | assert | variable | tests/rules/test_path_from_history.py | test_get_new_command | 43 | null | |
nvbn/thefuck | import pytest
from thefuck.rules.hostscli import no_website, get_new_command, match
from thefuck.types import Command
no_website_long = '''
{}:
No Domain list found for website: a_website_that_does_not_exist
Please raise a Issue here: https://github.com/dhilipsiva/hostscli/issues/new
if you think we should add domai... | result | assert | variable | tests/rules/test_hostscli.py | test_get_new_command | 27 | null | |
nvbn/thefuck | from mock import patch
from thefuck.rules.has_exists_script import match, get_new_command
from thefuck.types import Command
def test_get_new_command():
assert get_new_command(Command('main --help', '')) == | './main --help' | assert | string_literal | tests/rules/test_has_exists_script.py | test_get_new_command | 18 | null | |
nvbn/thefuck | import pytest
from thefuck.shells.tcsh import Tcsh
class TestTcsh(object):
def shell(self):
return Tcsh()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.tcsh.Popen')
mock.return_value.stdout.read.return_value = (
b'fuck\teval $(thefuck $(fc -ln -1))\n'
... | shell.app_alias('fuck') | assert | func_call | tests/shells/test_tcsh.py | test_app_alias | TestTcsh | 47 | null |
nvbn/thefuck | import pytest
from thefuck.rules.brew_install import match, get_new_command, _get_suggestions
from thefuck.types import Command
def brew_no_available_formula_one():
return '''Warning: No available formula with the name "giss". Did you mean gist?'''
def brew_no_available_formula_two():
return '''Warning: No av... | ['one', 'two', 'three'] | assert | collection | tests/rules/test_brew_install.py | test_suggestions | 34 | null | |
nvbn/thefuck | import os
import pytest
from thefuck.shells.zsh import Zsh
class TestZsh(object):
def shell(self):
return Zsh()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.zsh.Popen')
return mock
def shell_aliases(self):
os.environ['TF_SHELL_ALIASES'] = (
'fu... | alias | assert | variable | tests/shells/test_zsh.py | test_app_alias_variables_correctly_set | TestZsh | 58 | null |
nvbn/thefuck | from thefuck.rules.cd_parent import match, get_new_command
from thefuck.types import Command
def test_get_new_command():
assert get_new_command(Command('cd..', '')) == | 'cd ..' | assert | string_literal | tests/rules/test_cd_parent.py | test_get_new_command | 11 | null | |
nvbn/thefuck | import pytest
import six
import os
from mock import Mock
from thefuck import const
def load_source(mocker):
return mocker.patch('thefuck.conf.load_source')
def test_settings_defaults(load_source, settings):
load_source.return_value = object()
settings.init()
for key, val in const.DEFAULT_SETTINGS.item... | val | assert | variable | tests/test_conf.py | test_settings_defaults | 17 | null | |
nvbn/thefuck | import pytest
from thefuck.rules.aws_cli import match, get_new_command
from thefuck.types import Command
no_suggestions = '''\
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: argum... | result | assert | variable | tests/rules/test_aws_cli.py | test_get_new_command | 101 | null | |
nvbn/thefuck | from thefuck.rules.ls_lah import match, get_new_command
from thefuck.types import Command
def test_get_new_command():
assert get_new_command(Command('ls file.py', '')) == 'ls -lah file.py'
assert get_new_command(Command('ls', '')) == | 'ls -lah' | assert | string_literal | tests/rules/test_ls_lah.py | test_get_new_command | 16 | null | |
nvbn/thefuck | import pytest
from thefuck.rules.yarn_help import match, get_new_command
from thefuck.types import Command
from thefuck.system import open_command
output_clean = '''
Usage: yarn [command] [flags]
Options:
-h, --help output usage information
-V, --version output the... | open_command(url) | assert | func_call | tests/rules/test_yarn_help.py | test_get_new_command | 57 | null | |
nvbn/thefuck | import os
import pytest
from thefuck.rules.ssh_known_hosts import match, get_new_command, \
side_effect
from thefuck.types import Command
def ssh_error(tmpdir):
path = os.path.join(str(tmpdir), 'known_hosts')
def reset(path):
with open(path, 'w') as fh:
lines = [
'123.2... | expected | assert | variable | tests/rules/test_ssh_known_host.py | test_side_effect | 61 | null | |
nvbn/thefuck | import pytest
from thefuck.const import ARGUMENT_PLACEHOLDER
from thefuck.shells import Fish
class TestFish(object):
def shell(self):
return Fish()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.fish.Popen')
mock.return_value.stdout.read.side_effect = [(
b'cd... | '3.5.9' | assert | string_literal | tests/shells/test_fish.py | test_get_version | TestFish | 124 | null |
nvbn/thefuck | import pytest
from six import BytesIO
from thefuck.rules.ifconfig_device_not_found import match, get_new_command
from thefuck.types import Command
output = '{}: error fetching interface information: Device not found'
stdout = b'''
wlp2s0 Link encap:Ethernet HWaddr 5c:51:4f:7c:58:5d
inet addr:192.168.0.1... | result | assert | variable | tests/rules/test_ifconfig_device_not_found.py | test_get_new_comman | 53 | null | |
nvbn/thefuck | import pytest
from thefuck.types import Command
from thefuck.rules.heroku_multiple_apps import match, get_new_command
suggest_output = '''
▸ Multiple apps in git remotes
▸ Usage: --remote heroku-dev
▸ or: --app myapp-dev
▸ Your local git repository has more than 1 app referenced in git remotes.
▸ B... | result | assert | variable | tests/rules/test_heroku_multiple_apps.py | test_get_new_command | 55 | null | |
nvbn/thefuck | import pytest
import warnings
from mock import Mock, call, patch
from thefuck.utils import default_settings, \
memoize, get_closest, get_all_executables, replace_argument, \
get_all_matched_commands, is_app, for_app, cache, \
get_valid_history_without_current, _cache, get_close_matches
from thefuck.types im... | cache_value | assert | variable | tests/test_utils.py | test_with_filled_cache | TestCache | 229 | null |
nvbn/thefuck | import pytest
from thefuck.rules.git_fix_stash import match, get_new_command
from thefuck.types import Command
git_stash_err = '''
usage: git stash list [<options>]
or: git stash show [<stash>]
or: git stash drop [-q|--quiet] [<stash>]
or: git stash ( pop | apply ) [--index] [-q|--quiet] [<stash>]
or: git ... | fixed | assert | variable | tests/rules/test_git_fix_stash.py | test_get_new_command | 35 | null | |
nvbn/thefuck | from thefuck.rules.sl_ls import match, get_new_command
from thefuck.types import Command
def test_get_new_command():
assert get_new_command(Command('sl', '')) == | 'ls' | assert | string_literal | tests/rules/test_sl_ls.py | test_get_new_command | 12 | null | |
nvbn/thefuck | import pytest
import warnings
from mock import Mock, call, patch
from thefuck.utils import default_settings, \
memoize, get_closest, get_all_executables, replace_argument, \
get_all_matched_commands, is_app, for_app, cache, \
get_valid_history_without_current, _cache, get_close_matches
from thefuck.types im... | new | assert | variable | tests/test_utils.py | test_default_settings | 21 | null | |
nvbn/thefuck | import os
import pytest
from thefuck.shells.zsh import Zsh
class TestZsh(object):
def shell(self):
return Zsh()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.zsh.Popen')
return mock
def shell_aliases(self):
os.environ['TF_SHELL_ALIASES'] = (
'fu... | 'ls && cd' | assert | string_literal | tests/shells/test_zsh.py | test_and_ | TestZsh | 38 | null |
nvbn/thefuck | import pytest
from itertools import islice
from thefuck import ui
from thefuck.types import CorrectedCommand
from thefuck import const
def patch_get_key(monkeypatch):
def patch(vals):
vals = iter(vals)
monkeypatch.setattr('thefuck.ui.get_key', lambda: next(vals))
return patch
class TestSelect... | ('', stderr) | assert | collection | tests/test_ui.py | test_with_confirmation_select_second | TestSelectCommand | 108 | null |
nvbn/thefuck | import pytest
from thefuck.shells import Powershell
class TestPowershell(object):
def shell(self):
return Powershell()
def Popen(self, mocker):
mock = mocker.patch('thefuck.shells.powershell.Popen')
return mock
def test_and_(self, shell):
assert shell.and_('ls', 'cd') ==... | '(ls) -and (cd)' | assert | string_literal | tests/shells/test_powershell.py | test_and_ | TestPowershell | 19 | null |
nvbn/thefuck | def test_readme(source_root):
with source_root.joinpath('README.md').open() as f:
readme = f.read()
bundled = source_root.joinpath('thefuck') \
.joinpath('rules') \
.glob('*.py')
for rule in bundled:
if rule.stem != '__i... | readme | assert | variable | tests/test_readme.py | test_readme | 11 | null | |
nvbn/thefuck | import pytest
import six
import os
from mock import Mock
from thefuck import const
def load_source(mocker):
return mocker.patch('thefuck.conf.load_source')
class TestInitializeSettingsFile(object):
def test_ignore_if_exists(self, settings):
settings_path_mock = Mock(is_file=Mock(return_value=True), op... | 1 | assert | numeric_literal | tests/test_conf.py | test_ignore_if_exists | TestInitializeSettingsFile | 89 | null |
nvbn/thefuck | import pytest
from thefuck.rules.pip_unknown_command import match, get_new_command
from thefuck.types import Command
def pip_unknown_cmd_without_recommend():
return '''ERROR: unknown command "i"'''
def broken():
return 'instatl'
def suggested():
return 'install'
def pip_unknown_cmd(broken, suggested):
... | new_cmd | assert | variable | tests/rules/test_pip_unknown_command.py | test_get_new_command | 36 | null | |
nvbn/thefuck | from thefuck.rules.grep_recursive import match, get_new_command
from thefuck.types import Command
def test_get_new_command():
assert get_new_command(Command('grep blah .', '')) == | 'grep -r blah .' | assert | string_literal | tests/rules/test_grep_recursive.py | test_get_new_command | 14 | null |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.