How yannickg-1951517/tennis-game works
Project type and purpose
• This is a small, single‐purpose Python library/module that implements the scoring rules of a tennis game.
• It is designed and delivered with Test-Driven Development (TDD) using pytest.
File structure
• Top level:
• README.md – project description and run instructions
• requirements.txt – lists pytest (and any other dependencies)
• Package directory “tennis”:
• tennis_game.py – core domain logic (TennisGame class)
• test_tennis_game.py – exerciser of domain logic via pytest
README for additional insights
• Describes tennis scoring rules (love, 15, 30, 40, deuce, advantage, win).
• Emphasizes running tests with pytest (no external services or UI).
Main components and their interactions
a. TennisGame module (core component)
• Exposes an API:
• won_point(player_name)
• score() → returns string representation
• Holds internal state: player1 points, player2 points
b. Test suite (pytest)
• Imports TennisGame, drives scenarios (normal progression, deuce, advantage, win, edge cases)
• Verifies domain logic against expected outputs
c. Python runtime environment
• Virtual environment + interpreter executes both module and tests
Architectural patterns and design principles
• Single‐class domain model encapsulates all scoring logic
• TDD: tests first, then implementation
• Separation of concerns: no UI, no persistence, purely in‐memory logic