예제 #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'
예제 #2
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'
예제 #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']
예제 #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'
예제 #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'
예제 #6
0
def test_get_new_command(script, result):
    assert get_new_command(Command(script)) == result
예제 #7
0
def test_get_new_command(script, result):
    assert get_new_command(Command(script, "")) == result
예제 #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']
예제 #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'