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