Testing Git Tag Force Command Handling in TheFuck
This test suite validates the git_tag_force rule functionality in TheFuck project, specifically handling cases where Git tag commands fail due to existing tags. The tests ensure proper error detection and command correction behavior.
Test Coverage Overview
Implementation Analysis
Technical Details
Best Practices Demonstrated
nvbn/thefuck
tests/rules/test_git_tag_force.py
import pytest
from thefuck.rules.git_tag_force import match, get_new_command
from thefuck.types import Command
@pytest.fixture
def output():
return '''fatal: tag 'alert' already exists'''
def test_match(output):
assert match(Command('git tag alert', output))
assert not match(Command('git tag alert', ''))
def test_get_new_command(output):
assert (get_new_command(Command('git tag alert', output))
== "git tag --force alert")