Repository navigation
Commit 2fa90af
geometry: every blade's output read back out of a finished PDF (§ 13.2)
`test_dimensional.py` builds a PDF, parses it and checks the coordinates against
what the definition asked for — and § 13.2 calls that the most important test in
the suite. It only ever covered `lines`. Everything else rested on tests written
beside the code, which inherit the code's assumptions; reading the artefact back
does not.
`tests/test_geometry_readback.py` extends the discipline to the rest. The rule it
is written under is stated at the top of the file and matters more than any
single assertion: **every expected number comes from the definition, or from a
property the specification states in words, and never from the implementation.**
What is now measured out of real PDFs:
- **`tiling`** — the strongest of them. § 7.7 says `size` is the edge length for
every shape, so every single stroke on the sheet must be 10 mm long. Checked
for hex, tri, square, rhombus and octagon; and no inner edge is stroked twice,
which is § 7.7's load-bearing sentence.
- **`polar`** — ring radii against the cumulative series 12, 24, 48, 60 … that
`base_radius: 12mm` with `radius: [1, 1, 2]` spells out on paper; twelve 30°
spokes measured from the centre the *circles* give, and the twelfth lands back
on 0° (§ 3.3's reason for micro-degrees).
- **`mandala`** — rotate the whole drawing by a twelfth of a turn and it must map
onto itself. A property of the result; no arithmetic of the blade is consulted.
- **`perspective`** — every ray of a fan, extended to the horizon, crosses it
within a millimetre of one point. Concurrency is checkable without the blade.
- **`form`** — § 7.8's central claim, both halves: the same definition rules 8 mm
on A4 *and* on A5, while the field itself does change size. Either half alone
would prove nothing.
- **`dots`** (an exact 5 mm lattice, 35 × 52 of them, both counts from § 8.1's
arithmetic), **`grid`** (10×10 cells are 11×11 equal lines, and square on a
page that is not), **`staves`** (5 lines 2 mm apart, six times, and
`system_gap` measured as a *gap* and not a pitch), **`maze`** (every wall one
cell long and on the lattice, the grid 10×14), **`net`** (a tray of
80×50×20 mm is 120×90 mm flat, and creases are dashed where cuts are not).
`pdfread` grew a subpath reader for this — polygons and circles, on-curve points
only, because the Bézier control points are the writer's business and a test
that asserted on them would be checking reportlab.
**One real finding, and it came from writing the definitions out of the
specification rather than off the presets.** § 7.10 ends with "`labels: none`
unterdrückt die Beschriftung ganz". `tiling` took it; `grid` and `polar` refused
it with `Input should be a valid dictionary or instance of GridLabels` — an
internal class name, in answer to a definition copied straight out of the spec.
Omitting the key always worked, so nothing was unlabellable; the documented way
of saying it simply was not there. Now all three take it.
Three of the four first failures were **my** probes, not the code: `labels: none`
was the fourth. A tray has eight creases and not four — four floor-to-wall and
four where a glue tab meets its wall — and I had forgotten the tabs; the comment
now counts them off § 7.14 rather than trusting the number that came out.
1219 tests green (27 new), ruff clean, every committed example byte-identical.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>1 parent 9b8c82d commit 2fa90af
4 files changed
Lines changed: 557 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | | - | |
| 29 | + | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
| |||
72 | 72 | | |
73 | 73 | | |
74 | 74 | | |
75 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
76 | 90 | | |
77 | 91 | | |
78 | 92 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
32 | 32 | | |
33 | 33 | | |
34 | 34 | | |
35 | | - | |
| 35 | + | |
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
| |||
165 | 165 | | |
166 | 166 | | |
167 | 167 | | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
168 | 183 | | |
169 | 184 | | |
170 | 185 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
0 commit comments