1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-10-30 14:44:05 +00:00

#682: Unify work with output in classic and instant mode

This commit is contained in:
Vladimir Iakovlev
2017-08-31 17:58:56 +02:00
parent 96843fc6cd
commit 4625d8503d
237 changed files with 1322 additions and 1332 deletions

View File

@@ -1,26 +1,29 @@
import pytest
from thefuck.rules.whois import match, get_new_command
from tests.utils import Command
from thefuck.types import Command
@pytest.mark.parametrize('command', [
Command(script='whois https://en.wikipedia.org/wiki/Main_Page'),
Command(script='whois https://en.wikipedia.org/'),
Command(script='whois meta.unix.stackexchange.com')])
Command('whois https://en.wikipedia.org/wiki/Main_Page', ''),
Command('whois https://en.wikipedia.org/', ''),
Command('whois meta.unix.stackexchange.com', '')])
def test_match(command):
assert match(command)
def test_not_match():
assert not match(Command(script='whois'))
assert not match(Command('whois', ''))
# `whois com` actually makes sense
@pytest.mark.parametrize('command, new_command', [
(Command('whois https://en.wikipedia.org/wiki/Main_Page'), 'whois en.wikipedia.org'),
(Command('whois https://en.wikipedia.org/'), 'whois en.wikipedia.org'),
(Command('whois meta.unix.stackexchange.com'), ['whois unix.stackexchange.com',
'whois stackexchange.com',
'whois com'])])
(Command('whois https://en.wikipedia.org/wiki/Main_Page', ''),
'whois en.wikipedia.org'),
(Command('whois https://en.wikipedia.org/', ''),
'whois en.wikipedia.org'),
(Command('whois meta.unix.stackexchange.com', ''),
['whois unix.stackexchange.com',
'whois stackexchange.com',
'whois com'])])
def test_get_new_command(command, new_command):
assert get_new_command(command) == new_command