Add the shapes challenge to the command line
CI / checks (pull_request) Successful in 1m7s

turtle-challenges shapes draws the polygons. The argument parsing tests already
cover every registered name.

Task: MIL-003#6
This commit is contained in:
2026-10-07 23:59:08 +08:00
parent 32861fc58f
commit c695c47929
3 changed files with 11 additions and 1 deletions
+3
View File
@@ -10,10 +10,12 @@ from functools import partial
from turtle_challenges.constants import (
CHALLENGE_DASHED_LINE,
CHALLENGE_NAMES,
CHALLENGE_SHAPES,
CHALLENGE_SQUARE,
)
from turtle_challenges.dashed_line import draw_dashed_line
from turtle_challenges.pen import Pen
from turtle_challenges.shapes import draw_shapes
from turtle_challenges.square import draw_square
from turtle_challenges.window import (
TurtleUnavailableError,
@@ -52,6 +54,7 @@ def build_challenges(pen: Pen) -> dict[str, Callable[[], None]]:
return {
CHALLENGE_SQUARE: partial(draw_square, pen),
CHALLENGE_DASHED_LINE: partial(draw_dashed_line, pen),
CHALLENGE_SHAPES: partial(draw_shapes, pen),
}
+4
View File
@@ -68,8 +68,12 @@ CHALLENGE_SQUARE = "square"
## Command line name of challenge 2.
CHALLENGE_DASHED_LINE = "dashed-line"
## Command line name of challenge 3.
CHALLENGE_SHAPES = "shapes"
## Names of the challenges on the command line, in the order of the course.
CHALLENGE_NAMES: tuple[str, ...] = (
CHALLENGE_SQUARE,
CHALLENGE_DASHED_LINE,
CHALLENGE_SHAPES,
)