Testing CD Parent Command Correction in TheFuck
This test suite validates the functionality of the ‘cd_parent’ rule in TheFuck, which handles the common typo of typing ‘cd..’ instead of ‘cd ..’. The tests ensure proper command correction and error handling for directory navigation commands.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
nvbn/thefuck
tests/rules/test_cd_parent.py
from thefuck.rules.cd_parent import match, get_new_command
from thefuck.types import Command
def test_match():
assert match(Command('cd..', 'cd..: command not found'))
assert not match(Command('', ''))
def test_get_new_command():
assert get_new_command(Command('cd..', '')) == 'cd ..'