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(): 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']
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'
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'
def test_get_new_command(script, result): assert get_new_command(Command(script)) == result
def test_get_new_command(script, result): assert get_new_command(Command(script, "")) == result
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']
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'