From 91ec677025a24d431e508a22fef0adddbf1291dc Mon Sep 17 00:00:00 2001 From: Bryan Van Deusen Date: Thu, 8 Oct 2026 15:15:17 -0400 Subject: [PATCH] DRY pass #3: checklist near-misses live in the grammar fixture (#5373) test_notes.py and derive.rs each kept the same six lines of prose that look like a checklist item. Four were already task_lines cases in grammar.json; the other two (empty brackets, no bullet) join them, so the web suite now tests them too, and both hand lists go. Co-Authored-By: Claude Opus 5.5 --- core/src/local/derive.rs | 15 --------------- core/testdata/grammar.json | 2 ++ tests/test_notes.py | 15 --------------- 3 files changed, 2 insertions(+), 30 deletions(-) diff --git a/core/src/local/derive.rs b/core/src/local/derive.rs index 549f975..40410d7 100644 --- a/core/src/local/derive.rs +++ b/core/src/local/derive.rs @@ -611,21 +611,6 @@ mod tests { assert_eq!(extract_items(body), vec![item("middle", false, 1)]); } - #[test] - fn items_reject_near_misses() { - // Each of these is prose, and each has been someone's bug report somewhere. - for body in [ - "-[ ] no space after the dash", - "- [] empty brackets", - "- [ ]no space after the brackets", - "- [y] not a mark", - "a [ ] mid sentence", - "[ ] no bullet at all", - ] { - assert!(extract_items(body).is_empty(), "should be prose: {body}"); - } - } - #[test] fn items_accept_star_bullets_and_indentation() { // `*` because markdown.ts already takes it for a plain bullet. diff --git a/core/testdata/grammar.json b/core/testdata/grammar.json index 37679db..9c3e674 100644 --- a/core/testdata/grammar.json +++ b/core/testdata/grammar.json @@ -26,6 +26,8 @@ { "line": "+ [ ] plus bullet", "item": null }, { "line": "- [y] x", "item": null }, { "line": "- [ ] x", "item": null }, + { "line": "- [] empty brackets", "item": null }, + { "line": "[ ] no bullet at all", "item": null }, { "line": "text - [ ] x", "item": null }, { "line": "- milk", "item": null }, { "line": "", "item": null } diff --git a/tests/test_notes.py b/tests/test_notes.py index 34e2b33..961f02b 100644 --- a/tests/test_notes.py +++ b/tests/test_notes.py @@ -548,21 +548,6 @@ def test_parse_items_between_paragraphs(): assert [i.text for i in parse_items("before\n- [ ] middle\nafter")] == ["middle"] -@pytest.mark.parametrize( - "body", - [ - "-[ ] no space after the dash", - "- [] empty brackets", - "- [ ]no space after the brackets", - "- [y] not a mark", - "a [ ] mid sentence", - "[ ] no bullet at all", - ], -) -def test_parse_items_rejects_near_misses(body): - assert parse_items(body) == [] - - def test_parse_items_accepts_star_bullets_and_indentation(): # `*` because markdown.ts already takes it for a plain bullet. body = "* [ ] star\n - [x] indented"