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

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

View File

@@ -1,13 +1,20 @@
import pytest
from thefuck.rules.rm_dir import match, get_new_command
from tests.utils import Command
def test_match():
assert match(Command('rm foo', stderr='rm: foo: is a directory'), None)
assert match(Command('rm foo', stderr='rm: foo: Is a directory'), None)
assert not match(Command('rm foo'), None)
assert not match(Command('rm foo', stderr='foo bar baz'), None)
assert not match(Command(), None)
@pytest.mark.parametrize('command', [
Command('rm foo', stderr='rm: foo: is a directory'),
Command('rm foo', stderr='rm: foo: Is a directory')])
def test_match(command):
assert match(command, None)
assert match(command, None)
@pytest.mark.parametrize('command', [
Command('rm foo'), Command('rm foo'), Command()])
def test_not_match(command):
assert not match(command, None)
def test_get_new_command():