-
Notifications
You must be signed in to change notification settings - Fork 406
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes bug in repeat tests in romanText/translate.py; handles empty measures #1434
Conversation
Thanks! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Realizing that the empty measures can't end empty (and duration on a stream should not be manipulated) -- proposed solution in comments.
appendMeasureToRepeatEndingsDict(self.lastMeasureToken, | ||
mFill, | ||
self.repeatEndings, i) | ||
p.coreAppend(mFill) | ||
self.lastMeasureNumber = measureToken.number[0] - 1 | ||
self.lastMeasureToken = measureToken | ||
|
||
def fillMeasureFromPreviousRn(self, mFill: stream.Measure) -> None: | ||
if self.previousRn is not None: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is fine. but there's an easy refactor to avoid nesting.
if self.previousRn is None:
return
# mypy complains about the next line because | ||
# RecursiveIterator.first() has t.Optional type, but we know | ||
# it will not be None because we have just asserted that rn_iter | ||
# has length 1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that's fine. :-)
While working on addressing #1412 I noticed that there was a syntax error in the romanText in
testRepeats
(my bad!). Each measure number was followed by a colon (i.e., "m1:" rather than "m1"). The first thing this PR fixes is removing those colons.The colons caused the parser to insert a note in each measure. When I removed them, I discovered that the test was actually failing on measures that are empty except for forward/backward repeat bars. To fix this required two things:
I also added a new test for the copying of empty measures.