Skip to content

braille/test.py: add self.e English debug blocks before every self.b#1871

Merged
mscuthbert merged 4 commits intomasterfrom
claude/pensive-lamport-d844ca
Apr 17, 2026
Merged

braille/test.py: add self.e English debug blocks before every self.b#1871
mscuthbert merged 4 commits intomasterfrom
claude/pensive-lamport-d844ca

Conversation

@mscuthbert
Copy link
Copy Markdown
Member

@mscuthbert mscuthbert commented Apr 17, 2026

AI-Assisted -- myke read the helper files that created this, but not every line of the output.

Summary

  • Every braille test that had self.b now has a preceding self.e = '''...''' block showing the human-readable English description of the braille output. When a self.b assertion fails, a sighted maintainer can look at the self.e output to understand what notes/symbols are involved without having to read braille.
  • All previously-existing self.e blocks (which were placed after self.b) have been moved before their corresponding self.b.
  • test_example02_1's old self.e tested only bm.measures(1, 4); it has been replaced with a full-stream English block that matches what self.b actually tests.

Infrastructure fixes

  • runE now deep-copies the stream before calling the method with debug=True, so the English assertion never mutates the stream that runB subsequently tests. Without this, self.e-before-self.b ordering would cause some tests to fail because inPlace=True processing is not always idempotent.
  • _neutralizeSpacing now strips trailing whitespace per-line so incidental trailing spaces in debug output (e.g. Key Signature 0 flat(s) ) don't cause spurious assertion failures after ruff cleans the test file.

mscuthbert and others added 4 commits April 16, 2026 22:49
- Every test that had self.b now has a preceding self.e = '''...''' block
  showing the human-readable English description of the braille output,
  making it far easier for sighted maintainers to diagnose failures.
- Existing self.e blocks that were placed after self.b have been moved
  before self.b (or replaced with full-stream equivalents where the old
  block tested a stream subset).
- runE now deep-copies the stream before running with debug=True so it
  never mutates the stream that runB subsequently tests.
- _neutralizeSpacing now strips trailing whitespace per-line so that
  incidental trailing spaces in debug output (e.g. "Key Signature 0
  flat(s) ") do not cause spurious failures.
- All 152 tests pass; ruff clean across all of music21.

AI-assisted (Claude Sonnet 4.5).

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
The deepcopy of the stream used in runE causes a deque index error
in extractMeasureNumber for this specific test (stream with multiple
pop() calls). Remove the self.e block until the underlying issue
is resolved.

Also restore deepcopy in runE to prevent stream mutation from
affecting subsequent self.b assertions.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The transformation script incorrectly changed self.s = bm2 to self.s = bm
when converting makeNotation to inPlace=True. The rebase restored the
bm2 variable but left the wrong self.s assignment, causing partToBraille
to receive the un-notated flat stream instead of the measure-containing
bm2 stream.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@coveralls
Copy link
Copy Markdown

Coverage Status

coverage: 93.073% (+0.01%) from 93.062% — claude/pensive-lamport-d844ca into master

@mscuthbert mscuthbert merged commit d65c92b into master Apr 17, 2026
8 checks passed
@mscuthbert mscuthbert deleted the claude/pensive-lamport-d844ca branch April 17, 2026 13:54
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.

2 participants