From 8200b4183472d66f661190c04f9632006ecccbe9 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 5 Nov 2026 09:10:57 -0500 Subject: [PATCH 1/4] Report numeric mixed fractions as unread factors in the AB2026 checker The checker read "x 2 and a half" as a factor of 2, so "4" under it passed at 8. It now reports a factor that "and" and a fraction follow, at any value. We also add the locator rows for repeated closing square brackets, which a mutant allowing one such bracket passed. Co-Authored-By: Claude Opus 5.5 --- pipeline/ab2026_harvest_contract.py | 6 ++-- .../harvest-uk-ab2026-2026-10-29/README.md | 2 +- tests/test_ab2026_harvest_contract.py | 31 +++++++++++++++++++ 3 files changed, 36 insertions(+), 3 deletions(-) diff --git a/pipeline/ab2026_harvest_contract.py b/pipeline/ab2026_harvest_contract.py index 10c8b77e7..f7b54e74d 100644 --- a/pipeline/ab2026_harvest_contract.py +++ b/pipeline/ab2026_harvest_contract.py @@ -446,8 +446,10 @@ def _read(raw, normalization=""): _CHAIN = re.compile(rf"(?:^|(?<=[\s(\[]))({_STEP}(?:\s+{_STEP})*)") _OPERAND = re.compile(rf"10(?:\^|\*\*)(?P[0-9]+)|{_DIGITS}") # What would carry on a number the chain seems to end: "x 1 000 000", "x 1 million", -# "x 1 hundred" -_CONTINUES = re.compile(rf"\s+(?:[0-9]|(?:{_either(MULTIPLIERS)})\b)") +# "x 1 hundred", "x 2 and a half" +_CONTINUES = re.compile( + rf"\s+(?:[0-9]|(?:{_either(MULTIPLIERS)}|and\s+(?:half|{_PART}))\b)" +) # An operation on what the checker can't read as a number: a sign, bracket, quote # or currency sign first ("x (1e6)", "x +1e6", "x '1e6'", "x £100"), or number words # ("x one million", "x (a million)", "x half", "/ a quarter"). Also an operation in words ("times 1,000", diff --git a/sources/harvest-uk-ab2026-2026-10-29/README.md b/sources/harvest-uk-ab2026-2026-10-29/README.md index d3868bce5..46b50da36 100644 --- a/sources/harvest-uk-ab2026-2026-10-29/README.md +++ b/sources/harvest-uk-ab2026-2026-10-29/README.md @@ -72,7 +72,7 @@ We follow the AB2025 harvest README's rules 1–10 and its row contract, with th - a range: two figures joined by a dash, with no spaces or a space on each side ("£4-5 million", "4 – 5%"), or two numbers joined by "to" ("four to five", "4bn to 5bn"); - "nil", "none", "nothing", "no change", "no impact" or "no overall impact", as zero. It also reads a dash as zero where we say, in one whole clause of `normalization`, that the producer prints it for nil. It accepts forms such as "dash for nil" and "the table prints nil as a dash". It ends a clause at a comma, semicolon, full stop or bracket. - It also reads a qualifier before the number ("about", "up to" and the others in `QUALIFIERS`), "a" before digits ("less than a 0.1 percentage point"), and "a year" or "of GDP" after the number. It reads a ratio or worded fraction with its percentage in brackets, in either order, if the two agree to the nearest percentage point: "one third (33%)", "25% (1 in 4)". It matches `value` to either number there or in a range. It reports a range that joins a percentage to a multiplier ("4% to 2 million") or a fraction to a percentage ("a third to 40%"). It also reports a range whose first number exceeds its second, unless neither is positive: it reports "2025-26" and "2 to -3", and reads "-4 to -5". After a bare "in", it reports a year from 2010 to 2099 ("5 in 2027"). -- It takes each number's scale from its own word (bn, million, %). When only a range's second number has one, it gives that word to the first number too. When digits, number words or a whole number with a fraction have no word of their own, it uses the factor in `normalization`, failing that 1. It reads a factor whole ("x 1,000,000", "/ 100", "(x 10^6)"), multiplies operations in a row ("x 1,000,000 / 100" as 10,000), and takes either factor where a semicolon or a word separates two. It reads x, ×, *, / or ÷ as a factor wherever a number follows, at the note's start or after a space or bracket. It ignores a slash between digits ("2/3", "2026/27") but reads "page 3 / 4" as a factor of 0.25, so we write "page 3 of 4". At any value, it reports "x 1 million", "x (1e6)", "x one million", "x half", "times 1,000", "multiply by 1,000,000" and "£m×1e6". It reads a percentage as a share or in percent units, and requires digits and number words to match `value` within four units in the last place. +- It takes each number's scale from its own word (bn, million, %). When only a range's second number has one, it gives that word to the first number too. When digits, number words or a whole number with a fraction have no word of their own, it uses the factor in `normalization`, failing that 1. It reads a factor whole ("x 1,000,000", "/ 100", "(x 10^6)"), multiplies operations in a row ("x 1,000,000 / 100" as 10,000), and takes either factor where a semicolon or a word separates two. It reads x, ×, *, / or ÷ as a factor wherever a number follows, at the note's start or after a space or bracket. It ignores a slash between digits ("2/3", "2026/27") but reads "page 3 / 4" as a factor of 0.25, so we write "page 3 of 4". At any value, it reports "x 1 million", "x (1e6)", "x one million", "x half", "x 2 and a half", "times 1,000", "multiply by 1,000,000" and "£m×1e6". It reads a percentage as a share or in percent units, and requires digits and number words to match `value` within four units in the last place. - It reads a ratio or a worded fraction on its own as a share, and accepts a `value` within 0.1% of that share. On a `unit_concept: percent` row, it requires 100 times the share instead ("1 in 4" as 25). It won't match `value` to either of a ratio's numbers alone, and it reads "-1 in 4" and "1 in -4" as −0.25. It also allows 0.1% on a whole number with a fraction, and on a fraction of a multiplier or percentage. - It requires `value` to share `value_raw`'s sign unless we note in `normalization` that we took the sign from the wording. - It treats an HM Treasury Impact on households row as a bar reading (rule 4) if the row has `value_kind: approx_chart_reading`. It does the same if we mention a bar, chart, graph, plot, diagram or visual in the locator, in any spacing and with or without hyphens. It also counts "off" or "from" up to four words before a figure there. It does the same where we write in the locator that we read, took, estimated or measured the number using, on, in or of a figure, or read it by eye. It reads "Fig.", "Figs." and "figures" as figures, including where "figures" means numbers ("from HMT's figures"), and looks past a colon, brackets or quotes before them. It counts "read off Fig. 1.A", "read off: Fig. 1.A", "read from [Figure 1.A]" and "column 3 of Figure 1.A", and leaves "Table 2.1, column 3" alone. It ignores such a phrase right after one "no", "not", "never", "without", "cannot" or "n't" ("not a bar reading"). It counts the phrase after two negations in the same clause ("not possible without reading off the chart"). diff --git a/tests/test_ab2026_harvest_contract.py b/tests/test_ab2026_harvest_contract.py index 2439f430f..a2c96a738 100644 --- a/tests/test_ab2026_harvest_contract.py +++ b/tests/test_ab2026_harvest_contract.py @@ -2063,6 +2063,7 @@ def test_rule_4_holds_whatever_the_title_case(): ('paragraph 1.7; read off the "Impact on households" Figure 1.A', True), ("paragraph 1.7; read off the “Impact on households” Figure 1.A", True), ("paragraph 1.7; read from ((HMT)) Figure 1.A", True), + ("paragraph 1.7; read from [[HMT]] Figure 1.A", True), ('paragraph 1.7; read from "HMT" Figure 1.A', True), ("paragraph 1.7; read from (“HMT”) Figure 1.A", True), # Up to four words stand between "from" and the figure. @@ -2072,6 +2073,7 @@ def test_rule_4_holds_whatever_the_title_case(): ('paragraph 1.7; not read from "HMT" Figure 1.A', False), ("paragraph 1.7; not read from (“HMT”) Figure 1.A", False), ("paragraph 1.7; not read from ((HMT)) Figure 1.A", False), + ("paragraph 1.7; not read from [[HMT]] Figure 1.A", False), # a comma ends the words before a figure ("paragraph 1.7; figures from Table 2.C, Figure 1.A data label", False), ("paragraph 1.7; not read from [Figure 1.A]", False), @@ -2721,6 +2723,35 @@ def test_an_operand_the_checker_cant_read_is_a_problem_at_any_value(op, operand) assert any("a factor in normalization" in p for p in found), (note, value) +@pytest.mark.parametrize( + "note", + [ + "x 2 and a half", + "/ 2 and a half", + "x 2 and half", + "x 2 and three-quarters", + "x 2 and three quarters", + "(x 2 and a half)", + "as printed; x 2 and a half", + "x 1e6 / 2 and a half", + ], +) +def test_a_numeric_mixed_fraction_is_a_problem_at_any_value(note): + """Sol's review of 4dd5281d: the checker read "x 2 and a half" as a factor of 2, + so "4" under it passed at 8.""" + for value in (4, 8, 10, 1.6, 2e6): + found = problems(_share("4", value, note)) + assert any("a factor in normalization" in p for p in found), (note, value) + + +@pytest.mark.parametrize("note", ["x 2 and rounded", "x 2 and halfway", "x 2 and a"]) +def test_a_word_after_and_leaves_the_factor_alone(note): + """Only a fraction after "and" carries on the number.""" + assert not any( + "a factor in normalization" in p for p in problems(_share("4", 8, note)) + ) + + def test_a_long_run_of_quotes_stays_quick_to_read(): """If a quote could both open a word and stand as a bracket, the reading's time would grow with about the fifth power of the locator's length.""" From c9027fe290a6880c727c4e8ef19cf44426b3ecbe Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 5 Nov 2026 10:28:00 -0500 Subject: [PATCH 2/4] Read a run of whitespace in a normalization as one space Sol's review of 8200b418 found that two spaces or a tab hid the fraction in "x 2 and a half", so "4" under it passed at 8. The checker now reads any run of whitespace in a note as one space, as it already does in value_raw. We add three rows to the mixed-fraction matrix, a Hypothesis test that widens a space in 14 notes, and a clause in the README's list. Co-Authored-By: Claude Opus 5.5 --- pipeline/ab2026_harvest_contract.py | 3 +- .../harvest-uk-ab2026-2026-10-29/README.md | 2 +- tests/test_ab2026_harvest_contract.py | 38 +++++++++++++++++++ 3 files changed, 41 insertions(+), 2 deletions(-) diff --git a/pipeline/ab2026_harvest_contract.py b/pipeline/ab2026_harvest_contract.py index f7b54e74d..88b91ffa4 100644 --- a/pipeline/ab2026_harvest_contract.py +++ b/pipeline/ab2026_harvest_contract.py @@ -474,7 +474,8 @@ def _factors(normalization): """The multipliers a normalization states ("x 1,000,000", "/ 100", "(x 10^6)"), or None if it states one the checker can't read whole. Operations in a row make one multiplier: "x 1,000,000 / 100" is 10,000.""" - text = re.sub(r"\s*(\^|\*\*)\s*", r"\1", (normalization or "").lower()) + text = " ".join((normalization or "").lower().split()) + text = re.sub(r"\s*(\^|\*\*)\s*", r"\1", text) if _UNREAD.search(text): return None out = [] diff --git a/sources/harvest-uk-ab2026-2026-10-29/README.md b/sources/harvest-uk-ab2026-2026-10-29/README.md index 46b50da36..08096da8b 100644 --- a/sources/harvest-uk-ab2026-2026-10-29/README.md +++ b/sources/harvest-uk-ab2026-2026-10-29/README.md @@ -72,7 +72,7 @@ We follow the AB2025 harvest README's rules 1–10 and its row contract, with th - a range: two figures joined by a dash, with no spaces or a space on each side ("£4-5 million", "4 – 5%"), or two numbers joined by "to" ("four to five", "4bn to 5bn"); - "nil", "none", "nothing", "no change", "no impact" or "no overall impact", as zero. It also reads a dash as zero where we say, in one whole clause of `normalization`, that the producer prints it for nil. It accepts forms such as "dash for nil" and "the table prints nil as a dash". It ends a clause at a comma, semicolon, full stop or bracket. - It also reads a qualifier before the number ("about", "up to" and the others in `QUALIFIERS`), "a" before digits ("less than a 0.1 percentage point"), and "a year" or "of GDP" after the number. It reads a ratio or worded fraction with its percentage in brackets, in either order, if the two agree to the nearest percentage point: "one third (33%)", "25% (1 in 4)". It matches `value` to either number there or in a range. It reports a range that joins a percentage to a multiplier ("4% to 2 million") or a fraction to a percentage ("a third to 40%"). It also reports a range whose first number exceeds its second, unless neither is positive: it reports "2025-26" and "2 to -3", and reads "-4 to -5". After a bare "in", it reports a year from 2010 to 2099 ("5 in 2027"). -- It takes each number's scale from its own word (bn, million, %). When only a range's second number has one, it gives that word to the first number too. When digits, number words or a whole number with a fraction have no word of their own, it uses the factor in `normalization`, failing that 1. It reads a factor whole ("x 1,000,000", "/ 100", "(x 10^6)"), multiplies operations in a row ("x 1,000,000 / 100" as 10,000), and takes either factor where a semicolon or a word separates two. It reads x, ×, *, / or ÷ as a factor wherever a number follows, at the note's start or after a space or bracket. It ignores a slash between digits ("2/3", "2026/27") but reads "page 3 / 4" as a factor of 0.25, so we write "page 3 of 4". At any value, it reports "x 1 million", "x (1e6)", "x one million", "x half", "x 2 and a half", "times 1,000", "multiply by 1,000,000" and "£m×1e6". It reads a percentage as a share or in percent units, and requires digits and number words to match `value` within four units in the last place. +- It takes each number's scale from its own word (bn, million, %). When only a range's second number has one, it gives that word to the first number too. When digits, number words or a whole number with a fraction have no word of their own, it uses the factor in `normalization`, failing that 1. It reads a factor whole ("x 1,000,000", "/ 100", "(x 10^6)"), multiplies operations in a row ("x 1,000,000 / 100" as 10,000), and takes either factor where a semicolon or a word separates two. It reads x, ×, *, / or ÷ as a factor wherever a number follows, at the note's start or after a space or bracket, and it reads any run of whitespace in the note as one space. It ignores a slash between digits ("2/3", "2026/27") but reads "page 3 / 4" as a factor of 0.25, so we write "page 3 of 4". At any value, it reports "x 1 million", "x (1e6)", "x one million", "x half", "x 2 and a half", "times 1,000", "multiply by 1,000,000" and "£m×1e6". It reads a percentage as a share or in percent units, and requires digits and number words to match `value` within four units in the last place. - It reads a ratio or a worded fraction on its own as a share, and accepts a `value` within 0.1% of that share. On a `unit_concept: percent` row, it requires 100 times the share instead ("1 in 4" as 25). It won't match `value` to either of a ratio's numbers alone, and it reads "-1 in 4" and "1 in -4" as −0.25. It also allows 0.1% on a whole number with a fraction, and on a fraction of a multiplier or percentage. - It requires `value` to share `value_raw`'s sign unless we note in `normalization` that we took the sign from the wording. - It treats an HM Treasury Impact on households row as a bar reading (rule 4) if the row has `value_kind: approx_chart_reading`. It does the same if we mention a bar, chart, graph, plot, diagram or visual in the locator, in any spacing and with or without hyphens. It also counts "off" or "from" up to four words before a figure there. It does the same where we write in the locator that we read, took, estimated or measured the number using, on, in or of a figure, or read it by eye. It reads "Fig.", "Figs." and "figures" as figures, including where "figures" means numbers ("from HMT's figures"), and looks past a colon, brackets or quotes before them. It counts "read off Fig. 1.A", "read off: Fig. 1.A", "read from [Figure 1.A]" and "column 3 of Figure 1.A", and leaves "Table 2.1, column 3" alone. It ignores such a phrase right after one "no", "not", "never", "without", "cannot" or "n't" ("not a bar reading"). It counts the phrase after two negations in the same clause ("not possible without reading off the chart"). diff --git a/tests/test_ab2026_harvest_contract.py b/tests/test_ab2026_harvest_contract.py index a2c96a738..3223ed4cf 100644 --- a/tests/test_ab2026_harvest_contract.py +++ b/tests/test_ab2026_harvest_contract.py @@ -2734,6 +2734,9 @@ def test_an_operand_the_checker_cant_read_is_a_problem_at_any_value(op, operand) "(x 2 and a half)", "as printed; x 2 and a half", "x 1e6 / 2 and a half", + "x 2 and a half", + "x 2 and a\thalf", + "x 2 and a\u00a0half", ], ) def test_a_numeric_mixed_fraction_is_a_problem_at_any_value(note): @@ -2752,6 +2755,41 @@ def test_a_word_after_and_leaves_the_factor_alone(note): ) +@settings(max_examples=300, deadline=None) +@given( + note=st.sampled_from( + [ + "x 2", + "x 2.5", + "/ 100", + "x 1,000,000 / 100", + "x 10 ^ 6", + "times 1,000", + "x 1 million", + "as printed; x 2", + "as printed", + "x 2 and a half", + "x 2 and three quarters", + "x 2 and rounded", + "x 2 and halfway", + "x 2 and a", + ] + ), + run=st.sampled_from([" ", " ", "\t", "\n", " \t ", "\u00a0"]), + gap=st.integers(0, 20), + value=st.sampled_from([4, 8, 10, 40, 400, 4e6]), +) +def test_a_run_of_whitespace_in_a_note_reads_as_one_space(note, run, gap, value): + """Sol's review of 8200b418: two spaces or a tab hid the fraction in "x 2 and a + half", so "4" under it passed at 8.""" + spaces = [i for i, c in enumerate(note) if c == " "] + at = spaces[gap % len(spaces)] + stretched = note[:at] + run + note[at + 1 :] + assert bool(problems(_share("4", value, stretched))) == bool( + problems(_share("4", value, note)) + ), (stretched, value) + + def test_a_long_run_of_quotes_stays_quick_to_read(): """If a quote could both open a word and stand as a bracket, the reading's time would grow with about the fifth power of the locator's length.""" From 58f1eb5c6d5f5b7ff6c7b4a264fc7c499f1a8bce Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 5 Nov 2026 11:01:21 -0500 Subject: [PATCH 3/4] Read a worded sign through the same collapsed note as a factor "sign from the wording; x 2" with two spaces reported an opposite sign at -8, though the README says the checker reads any run of whitespace in a note as one space (Sol, review of c9027fe2). The checker now lower-cases the note and collapses its whitespace before it reads a worded sign, as it does before it reads a factor. The whitespace test now compares factors and complete problem lists, over every space in 20 notes, and Hypothesis tries all 29 whitespace characters. Co-Authored-By: Claude Opus 5.5 --- pipeline/ab2026_harvest_contract.py | 10 ++- tests/test_ab2026_harvest_contract.py | 105 +++++++++++++++++++------- 2 files changed, 84 insertions(+), 31 deletions(-) diff --git a/pipeline/ab2026_harvest_contract.py b/pipeline/ab2026_harvest_contract.py index 88b91ffa4..be5753787 100644 --- a/pipeline/ab2026_harvest_contract.py +++ b/pipeline/ab2026_harvest_contract.py @@ -470,12 +470,16 @@ def _read(raw, normalization=""): ) +def _collapsed(text): + """Text in lower case, with each run of whitespace as one space.""" + return " ".join((text or "").lower().split()) + + def _factors(normalization): """The multipliers a normalization states ("x 1,000,000", "/ 100", "(x 10^6)"), or None if it states one the checker can't read whole. Operations in a row make one multiplier: "x 1,000,000 / 100" is 10,000.""" - text = " ".join((normalization or "").lower().split()) - text = re.sub(r"\s*(\^|\*\*)\s*", r"\1", text) + text = re.sub(r"\s*(\^|\*\*)\s*", r"\1", _collapsed(normalization)) if _UNREAD.search(text): return None out = [] @@ -577,7 +581,7 @@ def value_problems(r): ): return [f"value {v!r} is not value_raw {raw!r} at a stated scale"] if ( - WORDED_SIGN.search(r.get("normalization") or "") + WORDED_SIGN.search(_collapsed(r.get("normalization"))) or any(_same(v, p) for p in exact) or any(_rounded(v, f) for f in near) ): diff --git a/tests/test_ab2026_harvest_contract.py b/tests/test_ab2026_harvest_contract.py index 3223ed4cf..4088e852e 100644 --- a/tests/test_ab2026_harvest_contract.py +++ b/tests/test_ab2026_harvest_contract.py @@ -23,6 +23,7 @@ from pipeline.ab2026_harvest_contract import ( OGL, + _factors, duplicate_problems, enums, family_problems, @@ -2755,39 +2756,87 @@ def test_a_word_after_and_leaves_the_factor_alone(note): ) +SPACED_NOTES = [ + "x 2", + "x 2.5", + "/ 100", + "x 1,000,000 / 100", + "x 10 ^ 6", + "times 1,000", + "x 1 million", + "as printed; x 2", + "as printed", + "x 2 and a half", + "x 2 and three quarters", + "x 2 and rounded", + "x 2 and halfway", + "x 2 and a", + "sign from the wording; x 2", + "carried negative; x 2", + "x 2 -> -8", + "x 2 → negative", + "dash for nil", + "the table prints nil as a dash", +] +WHITESPACE = [chr(c) for c in range(0x110000) if chr(c).isspace()] + + +def _stretch(note, at, run): + return note[:at] + run + note[at + 1 :] + + +@pytest.mark.parametrize("note", SPACED_NOTES) +def test_a_run_of_whitespace_in_a_note_reads_as_one_space(note): + """Sol's reviews of 8200b418 and c9027fe2: two spaces or a tab hid the fraction + in "x 2 and a half" and the sign in "sign from the wording", so the checker + gave another reading of the same note.""" + spaces = [i for i, c in enumerate(note) if c == " "] + for at, run in product(spaces, (" ", " ", "\t", "\n", " \t ", "\u00a0")): + stretched = _stretch(note, at, run) + assert _factors(stretched) == _factors(note), stretched + for raw, value in product( + ("4", "-"), (4, -8, 8, 10, 40, 400, 0.04, 40000, 4e6, 0) + ): + assert problems(_share(raw, value, stretched)) == problems( + _share(raw, value, note) + ), (stretched, raw, value) + + @settings(max_examples=300, deadline=None) @given( - note=st.sampled_from( - [ - "x 2", - "x 2.5", - "/ 100", - "x 1,000,000 / 100", - "x 10 ^ 6", - "times 1,000", - "x 1 million", - "as printed; x 2", - "as printed", - "x 2 and a half", - "x 2 and three quarters", - "x 2 and rounded", - "x 2 and halfway", - "x 2 and a", - ] - ), - run=st.sampled_from([" ", " ", "\t", "\n", " \t ", "\u00a0"]), + note=st.sampled_from(SPACED_NOTES), + run=st.text(st.sampled_from(WHITESPACE), min_size=1, max_size=4), gap=st.integers(0, 20), - value=st.sampled_from([4, 8, 10, 40, 400, 4e6]), + raw=st.sampled_from(["4", "-"]), + value=st.sampled_from([4, -8, 8, 40000, 0.04, 0]), ) -def test_a_run_of_whitespace_in_a_note_reads_as_one_space(note, run, gap, value): - """Sol's review of 8200b418: two spaces or a tab hid the fraction in "x 2 and a - half", so "4" under it passed at 8.""" +def test_any_whitespace_character_reads_as_one_space(note, run, gap, raw, value): spaces = [i for i, c in enumerate(note) if c == " "] - at = spaces[gap % len(spaces)] - stretched = note[:at] + run + note[at + 1 :] - assert bool(problems(_share("4", value, stretched))) == bool( - problems(_share("4", value, note)) - ), (stretched, value) + stretched = _stretch(note, spaces[gap % len(spaces)], run) + assert _factors(stretched) == _factors(note), stretched + assert problems(_share(raw, value, stretched)) == problems(_share(raw, value, note)) + + +@pytest.mark.parametrize( + "note", + [ + "sign from the wording; x 2", + "sign from the wording; x 2", + "sign\tfrom the wording; x 2", + "sign\u00a0from the wording; x 2", + "Sign from the wording; x 2", + "SIGN FROM THE WORDING; X 2", + "carried negative; x 2", + "x 2 -> -8", + "x 2 → negative", + ], +) +def test_a_worded_sign_reads_in_any_spacing_or_case(note): + assert not problems(_share("4", -8, note)) + + +def test_a_note_with_no_worded_sign_keeps_the_printed_sign(): + assert any("opposite sign" in p for p in problems(_share("4", -8, "x 2"))) def test_a_long_run_of_quotes_stays_quick_to_read(): From 967126541ffdfa2cb8ad3146caf50677eb56a605 Mon Sep 17 00:00:00 2001 From: Max Ghenis Date: Thu, 5 Nov 2026 11:56:01 -0500 Subject: [PATCH 4/4] Try every whitespace character in the whitespace test The parametrized test tried six runs and left the other whitespace characters to Hypothesis's random draws, so a mutant that misread an em space after "sign" survived one run (cloud review of 58f1eb5c). The test now tries all 29 characters at every space in each of the 20 notes, and compares factors and complete problem lists at 10 values. Co-Authored-By: Claude Opus 5.5 --- tests/test_ab2026_harvest_contract.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_ab2026_harvest_contract.py b/tests/test_ab2026_harvest_contract.py index 4088e852e..4d6b80609 100644 --- a/tests/test_ab2026_harvest_contract.py +++ b/tests/test_ab2026_harvest_contract.py @@ -2791,7 +2791,7 @@ def test_a_run_of_whitespace_in_a_note_reads_as_one_space(note): in "x 2 and a half" and the sign in "sign from the wording", so the checker gave another reading of the same note.""" spaces = [i for i, c in enumerate(note) if c == " "] - for at, run in product(spaces, (" ", " ", "\t", "\n", " \t ", "\u00a0")): + for at, run in product(spaces, (" ", " ", "\t", "\n", " \t ", *WHITESPACE)): stretched = _stretch(note, at, run) assert _factors(stretched) == _factors(note), stretched for raw, value in product(