Skip to content

Commit

Permalink
Merge pull request #1088 from jacobtylerwalls/braille-keywords-show
Browse files Browse the repository at this point in the history
Enable braille keywords in show() and write()
  • Loading branch information
mscuthbert committed Aug 18, 2021
2 parents b7bcad9 + f6d1854 commit baa8825
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion music21/converter/subConverters.py
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,7 @@ def show(self, obj, fmt, app=None, subformats=None, **keywords): # pragma: no c

def write(self, obj, fmt, fp=None, subformats=None, **keywords): # pragma: no cover
from music21 import braille
dataStr = braille.translate.objectToBraille(obj)
dataStr = braille.translate.objectToBraille(obj, **keywords)
if subformats is not None and 'ascii' in subformats:
dataStr = braille.basic.brailleUnicodeToBrailleAscii(dataStr)
fp = self.writeDataStream(fp, dataStr)
Expand Down Expand Up @@ -1547,6 +1547,15 @@ def testWriteMusicXMLMakeNotation(self):
for out in (out1, out2):
os.remove(out)

def testBrailleKeywords(self):
from music21 import converter

p = converter.parse('tinyNotation: c1 d1 e1 f1')
out = p.write('braille', debug=True)
with open(out, 'r') as f:
self.assertIn('<music21.braille.segment BrailleSegment>', f.read())
os.remove(out)


class TestExternal(unittest.TestCase):
show = True
Expand Down

0 comments on commit baa8825

Please sign in to comment.