braille/test.py: add self.e English debug blocks before every self.b#1871
Merged
mscuthbert merged 4 commits intomasterfrom Apr 17, 2026
Merged
braille/test.py: add self.e English debug blocks before every self.b#1871mscuthbert merged 4 commits intomasterfrom
mscuthbert merged 4 commits intomasterfrom
Conversation
- 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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
AI-Assisted -- myke read the helper files that created this, but not every line of the output.
Summary
self.bnow has a precedingself.e = '''...'''block showing the human-readable English description of the braille output. When aself.bassertion fails, a sighted maintainer can look at theself.eoutput to understand what notes/symbols are involved without having to read braille.self.eblocks (which were placed afterself.b) have been moved before their correspondingself.b.test_example02_1's oldself.etested onlybm.measures(1, 4); it has been replaced with a full-stream English block that matches whatself.bactually tests.Infrastructure fixes
runEnow deep-copies the stream before calling the method withdebug=True, so the English assertion never mutates the stream thatrunBsubsequently tests. Without this,self.e-before-self.bordering would cause some tests to fail becauseinPlace=Trueprocessing is not always idempotent._neutralizeSpacingnow 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.