Adds the Pen protocol and window helpers, a recording fake turtle for tests, draw_square and draw_dashed_line with their tests, and the command line entry point (turtle-challenges square and dashed-line).
Stacked on #30: the base branch is mil-001-project-foundation. Retarget this pull request to main after #30 is merged; the Closes lines take effect only when it lands on main.
Verification
Before each commit: ruff format --check, ruff check, mypy, pytest and doxygen Doxyfile (0 warnings). Every commit that touches src/ or tests/ carries a Task: MIL-NNN#N trailer, and the plan-first commit hook passed without a bypass.
Not in this pull request
#15 (review against QC-PY-001): its record RC-015 ends in Go and is carried by #33, the last pull request of the stack, which closes the issue when it reaches main.
## Milestone 002: Square and Dashed Line
Adds the `Pen` protocol and window helpers, a recording fake turtle for tests, `draw_square` and `draw_dashed_line` with their tests, and the command line entry point (`turtle-challenges square` and `dashed-line`).
Milestone document: [mil-002-square-and-dashed-line.md](https://git.tirsystem.com/Tirsvad-Udemy-100-days-of-code/018-turtle/src/branch/mil-002-square-and-dashed-line/docs/milestones/mil-002-square-and-dashed-line.md). Its Go / No-Go criteria and tasks are the checklist for this pull request.
Stacked on #30: the base branch is `mil-001-project-foundation`. Retarget this pull request to `main` after #30 is merged; the `Closes` lines take effect only when it lands on `main`.
### Verification
Before each commit: `ruff format --check`, `ruff check`, `mypy`, `pytest` and `doxygen Doxyfile` (0 warnings). Every commit that touches `src/` or `tests/` carries a `Task: MIL-NNN#N` trailer, and the plan-first commit hook passed without a bypass.
### Not in this pull request
- #15 (review against `QC-PY-001`): its record `RC-015` ends in Go and is carried by #33, the last pull request of the stack, which closes the issue when it reaches `main`.
### Issues
Closes #9
Closes #10
Closes #11
Closes #12
Closes #13
Closes #14
Tirsvad
added this to the Milestone 002: Square and Dashed Line milestone 2026-10-07 18:15:05 +02:00
The drawing functions take a Pen, the part of turtle.Turtle they use, so a test can
pass a fake that records every call. window.py is the only module that imports
turtle, and it does so inside the functions so that importing the package needs no Tk.
Task: MIL-002#1
Task: MIL-002#2
Challenge 1 draws four sides and turns right 90 degrees after each. Challenge 2 puts
the pen down for a dash and up for a gap and leaves it down at the end. Lengths and
counts come from constants.py; invalid values raise ValueError.
Task: MIL-002#3
Task: MIL-002#4
Task: MIL-002#5
python -m turtle_challenges <challenge> and the turtle-challenges command open a
window, run the named challenge and wait for a click. square and dashed-line are
registered; a missing Tk is reported with a hint instead of a traceback.
Task: MIL-002#6
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Milestone 002: Square and Dashed Line
Adds the
Penprotocol and window helpers, a recording fake turtle for tests,draw_squareanddraw_dashed_linewith their tests, and the command line entry point (turtle-challenges squareanddashed-line).Milestone document: mil-002-square-and-dashed-line.md. Its Go / No-Go criteria and tasks are the checklist for this pull request.
Stacked on #30: the base branch is
mil-001-project-foundation. Retarget this pull request tomainafter #30 is merged; theCloseslines take effect only when it lands onmain.Verification
Before each commit:
ruff format --check,ruff check,mypy,pytestanddoxygen Doxyfile(0 warnings). Every commit that touchessrc/ortests/carries aTask: MIL-NNN#Ntrailer, and the plan-first commit hook passed without a bypass.Not in this pull request
QC-PY-001): its recordRC-015ends in Go and is carried by #33, the last pull request of the stack, which closes the issue when it reachesmain.Issues
Closes #9
Closes #10
Closes #11
Closes #12
Closes #13
Closes #14