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