Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(Command('', ''), [], None),
(Command('vim', 'vim: command not found'),
['vim'], '/usr/bin/vim'),
(Command('sudo vim', 'vim: command not found'),
['vim'], '/usr/bin/vim')])
def test_not_match(mocker, command, packages, which):
mocker.patch('thefuck.rules.apt_get.which', return_value=which)
mocker.patch('thefuck.rules.apt_get._get_packages',
create=True, return_value=packages)
assert not match(command)
Command('git log README.md', ''),
Command('git log -p README.md', '')])
def test_not_match(command):
assert not match(command)
Command('php -S localhost:8000', ''),
Command('vim php -s', '')
])
def test_not_match(command):
assert not match(command)
Command('npm run live-tes', output('live-tes')),
Command('npm run-script sahare', output('sahare'))])
def test_match(command):
assert match(command)
(Command('go run foo', ''), 'go run foo.go'),
(Command('go run bar', ''), 'go run bar.go')])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command
Command('mvn -v', '')
])
def test_not_match(command):
assert not match(command)
(Command('yarn require lodash', output('require')),
'yarn add lodash')])
def test_get_new_command(command, result):
fixed_command = get_new_command(command)
if isinstance(fixed_command, list):
fixed_command = fixed_command[0]
assert fixed_command == result
Command(u'녀애 ㅣㄴ', 'command not found: 녀애 ㅣㄴ')])
def test_match(command):
assert switch_lang.match(command)
def test_not_match(script):
assert not match(Command(script, ''))
(Command('grunt cmpass:all', output('cmpass:all')), 'grunt compass:all'),
(Command('grunt cmpass:all --color', output('cmpass:all')),
'grunt compass:all --color')])
def test_get_new_command(command, result):
assert get_new_command(command) == result