def compare_humdrum_file(filename): with open(filename) as f: orig = f.read().strip() conv = emit.show_humdrum(humdrum.parse_file(filename)) s = difflib.SequenceMatcher(None, orig, conv) lines = zip(orig.splitlines(), conv.splitlines(), count()) diff = [(o, g, n) for o, g, n in lines if o != g] return s.ratio(), diff, orig, conv
def test_parse_file(): temp = tempfile.NamedTemporaryFile(mode='w+t') try: temp.writelines("**kern") temp.seek(0) sco = humdrum.parse_file(temp.name) assert sco[0][0].name == "kern" finally: temp.close()
def generate_humdrum(filename, options): print emit.show_humdrum(humdrum.parse_file(filename))
def generate_lilypond(filename, options): result = emit.show_lilypond(humdrum.parse_file(filename)) if not options.quiet: print result