1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-01-19 04:21:14 +00:00

Fix encoding for Python 2.7

This commit is contained in:
Daniel Herzog 2016-09-29 21:41:50 +01:00
parent 8938323229
commit ad53023860
2 changed files with 9 additions and 11 deletions

View File

@ -1,18 +1,15 @@
# -*- coding: utf-8 -*-
import pytest import pytest
from thefuck.rules.remove_trailing_cedilla import match, get_new_command from thefuck.rules.remove_trailing_cedilla import match, get_new_command, CEDILLA
from tests.utils import Command from tests.utils import Command
@pytest.mark.parametrize('command', [ @pytest.mark.parametrize('command', [
Command(script='wrongç'), Command(script='wrong' + CEDILLA),
Command(script='wrong with argsç')]) Command(script='wrong with args' + CEDILLA)])
def test_match(command): def test_match(command):
assert match(command) assert match(command)
@pytest.mark.parametrize('command, new_command', [ @pytest.mark.parametrize('command, new_command', [
(Command('wrongç'), 'wrong'), (Command('wrong' + CEDILLA), 'wrong'),
(Command('wrong with argsç'), 'wrong with args')]) (Command('wrong with args' + CEDILLA), 'wrong with args')])
def test_get_new_command(command, new_command): def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command assert get_new_command(command) == new_command

View File

@ -1,8 +1,9 @@
# -*- coding: utf-8 -*- # encoding=utf8
CEDILLA = u"ç"
def match(command): def match(command):
return command.script.endswith('ç') return command.script.endswith(CEDILLA)
def get_new_command(command): def get_new_command(command):
return command.script[:-1] return command.script[:-1]