1
0
mirror of https://github.com/nvbn/thefuck.git synced 2024-10-06 10:51:11 +01:00
thefuck/tests/rules/test_switch_lang.py

28 lines
958 B
Python
Raw Normal View History

2015-04-21 05:26:15 +01:00
# -*- encoding: utf-8 -*-
import pytest
2015-04-21 05:26:15 +01:00
from thefuck.rules import switch_lang
from tests.utils import Command
2015-04-21 05:26:15 +01:00
@pytest.mark.parametrize('command', [
Command(stderr='command not found: фзе-пуе', script=u'фзе-пуе'),
Command(stderr='command not found: λσ', script=u'λσ')])
def test_match(command):
assert switch_lang.match(command, None)
2015-04-21 21:09:48 +01:00
2015-04-21 05:26:15 +01:00
@pytest.mark.parametrize('command', [
Command(stderr='command not found: pat-get', script=u'pat-get'),
Command(stderr='command not found: ls', script=u'ls'),
Command(stderr='some info', script=u'фзе-пуе')])
def test_not_match(command):
assert not switch_lang.match(command, None)
2015-04-21 05:26:15 +01:00
@pytest.mark.parametrize('command, new_command', [
(Command(u'фзе-пуе штыефдд мшь'), 'apt-get install vim'),
(Command(u'λσ -λα'), 'ls -la')])
def test_get_new_command(command, new_command):
assert switch_lang.get_new_command(command, None) == new_command