Example #1
0
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
Example #2
0
def test_show_note_c_with_articulations():
    note3 = score.Note("C", Fraction(1, 4))
    note3.articulations = ["harmonic", "turn", "tie-start"]
    assert emit.show_humdrum(note3) == "4coS["
Example #3
0
def test_show_note_c2f(two_notes):
    note1, note2 = two_notes
    assert emit.show_humdrum(note2) == "4.C--"
Example #4
0
def test_show_note_cs(two_notes):
    note1, note2 = two_notes
    assert emit.show_humdrum(note1) == "4cccc#"
Example #5
0
def test_show_list(two_notes):
    note1, note2 = two_notes
    alist = [note1, note2]
    assert emit.show_humdrum(alist) == "4cccc#	4.C--"
Example #6
0
def generate_humdrum(filename, options):
    print emit.show_humdrum(humdrum.parse_file(filename))
Example #7
0
def test_show_nulltoken():
    assert emit.show_humdrum(score.NullToken()) == "."
Example #8
0
def test_show_rest():
    rest = score.Rest(Fraction(3, 8))
    assert emit.show_humdrum(rest) == "4.r"
Example #9
0
def test_show_spine_end():
    assert emit.show_humdrum(score.SpinePath("spine-end")) == '*-'
Example #10
0
def test_show_nullinterpretation():
    assert emit.show_humdrum(score.NullInterpretation()) == '*'
Example #11
0
def test_show_exclusive():
    exclusive = score.Exclusive("kern")
    assert emit.show_humdrum(exclusive) == "**kern"
Example #12
0
def test_show_tandem_instrument_user():
    tandem = score.Tandem("instrument-user", "violin")
    assert emit.show_humdrum(tandem) == '*I:violin'
Example #13
0
def test_show_comment():
    comment = score.Comment("bla bla", 2)
    assert emit.show_humdrum(comment) == '!! bla bla'
Example #14
0
def test_show_record():
    record = score.Record("COM", "J. S. Bach")
    assert emit.show_humdrum(record) == '!!! COM: J. S. Bach'
Example #15
0
def test_show_chord(two_notes):
    note1, note2 = two_notes
    chord = score.MultipleStop([note1, note2])
    assert emit.show_humdrum(chord) == "4cccc# 4.C--"
Example #16
0
def test_show_bar():
    bar = score.Bar(2)
    assert emit.show_humdrum(bar) == "=2"
Example #17
0
def test_show_spine_add():
    assert emit.show_humdrum(score.SpinePath("spine-add")) == '*+'
Example #18
0
def test_show_blankline():
    assert emit.show_humdrum(score.BlankLine()) == "\n"
Example #19
0
def test_show_spine_split():
    assert emit.show_humdrum(score.SpinePath("spine-split")) == '*^'
Example #20
0
def test_show_unknowntype():
    unknowntype = score.UnknownType("foo")
    assert emit.show_humdrum(unknowntype) == "foo"
Example #21
0
def test_show_spine_join():
    assert emit.show_humdrum(score.SpinePath("spine-join")) == '*v'
Example #22
0
def test_show_spine_swap():
    assert emit.show_humdrum(score.SpinePath("spine-swap")) == '*x'
Example #23
0
def test_show_score(two_notes):
    record = score.Record("COM", "J. S. Bach")
    kern = score.Exclusive("kern")
    note1, note2 = two_notes
    sco = score.Score(record, kern, [note1], [note2])
    assert emit.show_humdrum(sco) == "!!! COM: J. S. Bach\n**kern\n4cccc#\n4.C--"