Use parametrized tests where it possible

This commit is contained in:
nvbn
2015-04-25 02:54:39 +02:00
parent b7cb407637
commit 698451f65d
6 changed files with 85 additions and 56 deletions
+9 -4
View File
@@ -1,11 +1,16 @@
import pytest
from thefuck.rules.sudo import match, get_new_command
from tests.utils import Command
def test_match():
assert match(Command(stderr='Permission denied'), None)
assert match(Command(stderr='permission denied'), None)
assert match(Command(stderr="npm ERR! Error: EACCES, unlink"), None)
@pytest.mark.parametrize('stderr', ['Permission denied',
'permission denied',
"npm ERR! Error: EACCES, unlink"])
def test_match(stderr):
assert match(Command(stderr=stderr), None)
def test_not_match():
assert not match(Command(), None)