Skip to content

Tests: negative assertions that could not fire, and a test that pins inbound_count - #115

Merged
muellerei merged 1 commit into
mainfrom
test/negative-assertions-that-can-fire
Oct 3, 2026
Merged

muellerei merged 1 commit into
mainfrom
test/negative-assertions-that-can-fire

Conversation

@muellerei

Copy link
Copy Markdown
Owner

Three assertions checked that a message is absent, and the message no longer exists, so they could never fail:

  • test_journal_block_reports_its_position: "Could not find or create" went with the top-level fallback in 8926e36. The line is redundant: json.loads(result.stderr) above it already requires stderr to be one JSON object, so any extra warning fails the test first. Removed.
  • test_keep_block_ids and test_keep_ids_every_writer: "cannot preserve" went with the note in 5860462, when top-level blocks began to keep their ids. They now check that the note which does exist, the dropped-id:: one, does not appear; their sibling tests assert the same text is there when ids are dropped. stderr is not empty in every case (add-journal-block --file prints an unrelated note), so a blanket emptiness check would break on that.

test_get_page_stats_does_not_report_zero_inbound_links_after_an_error looked for "inbound_count" in stdout, and no test expected the field anywhere: renaming it left the whole suite green. A new test reads the stats when the scan can read every page and expects the field and its value.

Checked

  • 3266 tests, ruff check ..
  • Printing the dropped-id note despite --keep-ids passes the old assertions and fails the new ones, in all eight cases.
  • Renaming inbound_count passes the whole suite as it stands on main and fails the new test.
  • Printing the old fallback warning fails the journal test with or without the removed line.

Not changed: (empty), Added block-ref, Done. and one note in init_config have the same kind of loose wording check; each has part of its claim covered elsewhere, and none has let anything through so far.

…d_count

Three assertions checked that a message is absent, and the message no longer
exists, so they could never fail:

- test_journal_block_reports_its_position: "Could not find or create" went
  with the top-level fallback in 8926e36. The line is redundant: the
  json.loads(result.stderr) above it already requires stderr to be one JSON
  object, so any extra warning fails the test first.
- test_keep_block_ids and test_keep_ids_every_writer: "cannot preserve" went
  with the note in 5860462, when top-level blocks began to keep their ids.
  They now check that the note which does exist, the dropped-id:: one, does
  not appear; its sibling tests assert the same text is there when ids are
  dropped. stderr is not empty in every case (add-journal-block --file prints
  an unrelated note), so a blanket emptiness check would break on that.

test_get_page_stats_does_not_report_zero_inbound_links_after_an_error looked
for '"inbound_count"' in stdout, and no test expected the field anywhere.
Renaming it left the whole suite green. A new test reads the stats when the
scan can read every page and expects the field and its value.

Checked by mutation. Printing the dropped-id note despite --keep-ids passes
the old assertions and fails the new ones in all eight cases. Renaming
inbound_count passes the whole suite as it stands on main and fails the new
test. Printing the old fallback warning fails the journal test with or
without the removed line.
@muellerei
muellerei merged commit 153ec82 into main Oct 3, 2026
6 checks passed
@muellerei
muellerei deleted the test/negative-assertions-that-can-fire branch October 3, 2026 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant