1
0
mirror of https://github.com/nvbn/thefuck.git synced 2025-03-03 09:19:00 +00:00

add tests for upper_to_lowercase rule

This commit is contained in:
Nikos Kakonas 2022-05-07 22:52:56 +00:00
parent 9680c84848
commit 8b2b3d7e4f

View File

@ -0,0 +1,47 @@
import pytest
from thefuck.rules.upper_to_lowercase import match, get_new_command
from thefuck.types import Command
@pytest.mark.parametrize(
"script, output",
[
("LS", ""),
("CD THEFUCK", ""),
("CAT README.MD", ""),
("MV TESTS TESTING", ""),
("GIT ADD .", ""),
],
)
def test_match(script, output):
assert match(Command(script, output))
@pytest.mark.parametrize(
"script, output",
[
("ls", ""),
("cd thefuck", ""),
("cat README.md", ""),
("mv tests testing", ""),
("git add .", ""),
],
)
def test_not_match(script, output):
assert not match(Command(script, output))
@pytest.mark.parametrize(
"script, output, new_command",
[
("LS", "", "ls"),
("CD THEFUCK", "", "cd thefuck"),
("CAT README.MD", "", "cat readme.md"),
("MV TESTS TESTING", "", "mv tests testing"),
("GIT ADD .", "", "git add ."),
],
)
def test_get_new_command(script, output, new_command):
assert get_new_command(Command(script, output)) == new_command