From 95007220fbe4c5554a92b2b688fb9724ec949ebd Mon Sep 17 00:00:00 2001 From: mcarton Date: Fri, 8 May 2015 11:42:00 +0200 Subject: [PATCH] Add a test for the DRY rule --- tests/rules/test_dry.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/rules/test_dry.py diff --git a/tests/rules/test_dry.py b/tests/rules/test_dry.py new file mode 100644 index 00000000..757866df --- /dev/null +++ b/tests/rules/test_dry.py @@ -0,0 +1,17 @@ +import pytest +from thefuck.rules.dry import match, get_new_command +from tests.utils import Command + + +@pytest.mark.parametrize('command', [ + Command(script='cd cd foo'), + Command(script='git git push origin/master')]) +def test_match(command): + assert match(command, None) + + +@pytest.mark.parametrize('command, new_command', [ + (Command('cd cd foo'), 'cd foo'), + (Command('git git push origin/master'), 'git push origin/master')]) +def test_get_new_command(command, new_command): + assert get_new_command(command, None) == new_command