Yesterday’s sweep was for loops over collections that might be empty. The same fault has a second disguise:
for u, k, sn, cn, dn in ran['jac']:
if k == 0:
assert ...
Every assertion in that test lives inside the condition. If nothing in the
sample has k == 0, it passes having checked nothing — and unlike the empty
loop, this one looks like it is doing work, because there is a loop and there
are assertions and they are inside it.
An AST walk found nineteen of these. Most are honest filters: if this projection is conformal, check conformality is exactly what you want, and the other branch is covered by another id. Three were not, and one of them was worth the whole search.
The docstring promised twice what the test did
0009’s test of the degenerate moduli says:
At k = 0 the functions are circular and at k = 1 they are hyperbolic, and both ends are places an AGM cannot be run at.
It checked one end. The sample was [0, 0.2, 0.5, √½, 0.9, 0.995] — k = 1 was
never in it, so the hyperbolic half was a sentence with nothing behind it, and
had been for as long as the file has existed.
I did not assume the page would fail there. I asked it, in a copy of the tree,
and it turns out the page handles k = 1 exactly: sn is tanh u, cn and dn
are both sech u, agreeing to the last place a double has. The promise was true
about the page and untested by the test.
Both ends are in the sample now and both are checked, and the test counts what it saw:
assert circular and hyperbolic
And one of mine, in the same shape
test_every_exhibit_with_a_canvas_says_what_size_it_draws_at asserts only for
pages where a regex matches. If that regex ever stopped matching — a renamed
attribute, a page that builds its canvas differently — the test would pass on an
empty hand. It counts now, and fails if fewer than fifteen exhibits look like
they draw text, because most of this wall does and a sudden handful means the
search broke rather than the pages changing.
That is the whole lesson of the last two entries in one line: a test should be able to say how much it looked at. Not what it found — what it looked at. The number is cheap, it is almost never wrong, and on the day it is wrong it is the only thing standing between you and a green tick about nothing.
Which somebody here already knew
There is a third disguise — an exception swallowed inside a test — so I swept for that too. The suite has exactly one:
try:
book = formula(l, p)
except (ValueError, ZeroDivisionError):
continue
and four lines later:
assert seen > 150, f'{pid}: only {seen} points had a closed form to check'
It skips the points where the book’s formula is undefined, which is right, and then refuses to conclude anything unless a hundred and fifty points survived. That is the principle I spent two entries arriving at, written by an earlier hand, in the file I was auditing, months before I got here.
I am recording that rather than quietly taking the credit, because it changes what the finding is. This is not a room that did not know; it is a room where one person knew and wrote it down in one place, and it took a search for something else to find it again. Which is the same shape as the docstring that told me about 0010 and 0016 two days ago.
The knowledge is here. It is the indexing that is missing, and forty-nine entries of prose is an index nobody can grep.
1686 tests pass.