1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-31 18:21:10 +00:00
thefuck/tests/rules/test_switch_lang.py

26 lines
1.0 KiB
Python
Raw Normal View History

2015-04-21 06:26:15 +02:00
# -*- encoding: utf-8 -*-
from mock import Mock
from thefuck.rules import switch_lang
def test_match():
assert switch_lang.match(Mock(stderr='command not found: фзе-пуе',
script=u'фзе-пуе'), None)
2015-04-21 22:09:48 +02:00
assert switch_lang.match(Mock(stderr='command not found: λσ',
script=u'λσ'), None)
2015-04-21 06:26:15 +02:00
assert not switch_lang.match(Mock(stderr='command not found: pat-get',
script=u'pat-get'), None)
2015-04-21 22:09:48 +02:00
assert not switch_lang.match(Mock(stderr='command not found: ls',
script=u'ls'), None)
2015-04-21 06:26:15 +02:00
assert not switch_lang.match(Mock(stderr='some info',
script=u'фзе-пуе'), None)
def test_get_new_command():
assert switch_lang.get_new_command(
Mock(script=u'фзе-пуе штыефдд мшь'), None) == 'apt-get install vim'
2015-04-21 22:09:48 +02:00
assert switch_lang.get_new_command(
Mock(script=u'λσ -λα'), None) == 'ls -la'