Description
The project currently lacks automated tests. Adding unit tests would improve code reliability and make future refactoring safer.
Scope
Prioritize testing for these functions:
normalize() - Text normalization with accents and special characters
parse_cifra_html() - HTML parsing and chord markup conversion
- URL generation logic in
fetch_song()
Suggested Framework
pytest - Modern Python testing framework
pytest-cov - Code coverage reporting
Example Test Structure
# test_main.py
import pytest
from main import OpenCifraApp
def test_normalize_accents():
app = OpenCifraApp()
assert app.normalize("João") == "joao"
assert app.normalize("Música") == "musica"
def test_normalize_special_chars():
app = OpenCifraApp()
assert app.normalize("Rock & Roll!") == "rock & roll"
Additional Considerations
- Add GitHub Actions workflow for CI
- Set target coverage threshold (e.g., 70%)
- Document testing setup in README
Description
The project currently lacks automated tests. Adding unit tests would improve code reliability and make future refactoring safer.
Scope
Prioritize testing for these functions:
normalize()- Text normalization with accents and special charactersparse_cifra_html()- HTML parsing and chord markup conversionfetch_song()Suggested Framework
pytest- Modern Python testing frameworkpytest-cov- Code coverage reportingExample Test Structure
Additional Considerations