From b65e3a9aaded6c7f223597794f5b3711483aeffc Mon Sep 17 00:00:00 2001 From: Omer Katz Date: Mon, 29 Jan 2018 09:46:18 +0200 Subject: [PATCH] Added hebrew the list of keyboard layouts (#778) * Added hebrew the list of keyboard layouts. Fixes #776. * Added tests for hebrew layout. * Fix test. * Make lint happy. --- tests/rules/test_switch_lang.py | 11 ++++++++--- thefuck/rules/switch_lang.py | 3 ++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/tests/rules/test_switch_lang.py b/tests/rules/test_switch_lang.py index 5d22f949..e2da837d 100644 --- a/tests/rules/test_switch_lang.py +++ b/tests/rules/test_switch_lang.py @@ -7,7 +7,9 @@ from thefuck.types import Command @pytest.mark.parametrize('command', [ Command(u'фзе-пуе', 'command not found: фзе-пуе'), - Command(u'λσ', 'command not found: λσ')]) + Command(u'λσ', 'command not found: λσ'), + Command(u'שפא-עקא', 'command not found: שפא-עקא'), + Command(u'ךד', 'command not found: ךד')]) def test_match(command): assert switch_lang.match(command) @@ -16,13 +18,16 @@ def test_match(command): Command(u'pat-get', 'command not found: pat-get'), Command(u'ls', 'command not found: ls'), Command(u'агсл', 'command not found: агсл'), - Command(u'фзе-пуе', 'some info')]) + Command(u'фзе-пуе', 'some info'), + Command(u'שפא-עקא', 'some info')]) def test_not_match(command): assert not switch_lang.match(command) @pytest.mark.parametrize('command, new_command', [ (Command(u'фзе-пуе штыефдд мшь', ''), 'apt-get install vim'), - (Command(u'λσ -λα', ''), 'ls -la')]) + (Command(u'λσ -λα', ''), 'ls -la'), + (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) == new_command diff --git a/thefuck/rules/switch_lang.py b/thefuck/rules/switch_lang.py index e67c89d5..49ceec06 100644 --- a/thefuck/rules/switch_lang.py +++ b/thefuck/rules/switch_lang.py @@ -5,7 +5,8 @@ target_layout = '''qwertyuiop[]asdfghjkl;'zxcvbnm,./QWERTYUIOP{}ASDFGHJKL:"ZXCVB source_layouts = [u'''йцукенгшщзхъфывапролджэячсмитьбю.ЙЦУКЕНГШЩЗХЪФЫВАПРОЛДЖЭЯЧСМИТЬБЮ,''', u'''ضصثقفغعهخحجچشسیبلاتنمکگظطزرذدپو./ًٌٍَُِّْ][}{ؤئيإأآة»«:؛كٓژٰ‌ٔء><؟''', - u''';ςερτυθιοπ[]ασδφγηξκλ΄ζχψωβνμ,./:΅ΕΡΤΥΘΙΟΠ{}ΑΣΔΦΓΗΞΚΛ¨"ΖΧΨΩΒΝΜ<>?'''] + u''';ςερτυθιοπ[]ασδφγηξκλ΄ζχψωβνμ,./:΅ΕΡΤΥΘΙΟΠ{}ΑΣΔΦΓΗΞΚΛ¨"ΖΧΨΩΒΝΜ<>?''', + u'''/'קראטוןםפ][שדגכעיחלךף,זסבהנמצתץ.QWERTYUIOP{}ASDFGHJKL:"ZXCVBNM<>?'''] @memoize