Beispiel #1
0
def test_get_new_command(command_found):
    with patch('thefuck.rules.no_command._get_output',
               return_value=command_found.decode()):
        assert get_new_command(Command('aptget install vim', '', ''), settings)\
            == 'apt-get install vim'
        assert get_new_command(Command('sudo aptget install vim', '', ''), settings) \
            == 'sudo apt-get install vim'
def test_get_new_command(command_found):
    with patch('thefuck.rules.no_command._get_output',
               return_value=command_found.decode()):
        assert get_new_command(Command('aptget install vim', '', ''), settings)\
            == 'apt-get install vim'
        assert get_new_command(Command('sudo aptget install vim', '', ''), settings) \
            == 'sudo apt-get install vim'
Beispiel #3
0
def test_get_new_command():
    assert get_new_command(
        Command(stderr='vom: not found',
                script='vom file.py')) == ['vim file.py']
    assert get_new_command(
        Command(stderr='fucck: not found',
                script='fucck')) == ['fsck']
Beispiel #4
0
def test_get_new_command(*args):
    assert get_new_command(
        Command(stderr='vom: not found',
                script='vom file.py'),
        None) == 'vim file.py'
    assert get_new_command(
        Command(stderr='fucck: not found',
                script='fucck'),
        Command) == 'fsck'
Beispiel #5
0
def test_get_new_command():
    with patch('thefuck.rules.no_command._get_all_callables',
               return_value=['vim', 'apt-get']):
        assert get_new_command(
            Mock(stderr='vom: not found',
                 script='vom file.py'),
            None) == 'vim file.py'
Beispiel #6
0
def test_get_new_command(script, result):
    assert get_new_command(Command(script)) == result
Beispiel #7
0
def test_get_new_command(script, result):
    assert get_new_command(Command(script, "")) == result
Beispiel #8
0
def test_get_new_command():
    assert get_new_command(
        Command(stderr='vom: not found',
                script='vom file.py')) == ['vim file.py']
    assert get_new_command(Command(stderr='fucck: not found',
                                   script='fucck')) == ['fsck']
Beispiel #9
0
def test_get_new_command(*args):
    assert get_new_command(Mock(stderr='vom: not found', script='vom file.py'),
                           None) == 'vim file.py'
    assert get_new_command(Mock(stderr='fucck: not found', script='fucck'),
                           None) == 'fsck'