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:
@@ -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():
|
||||
|
||||
Reference in New Issue
Block a user