Example #1
0
def test_parse_chart_fucky_spacing():
    chart = parse.parse_chart(FUCKY_CHART)

    assert len(chart.measures) == 2

    assert len(chart.measures[0].notes) == 2
    assert len(chart.measures[1].notes) == 2
Example #2
0
def test_parse_strip_comments():
    chart = parse.parse_chart(COMMENT_CHART)

    assert len(chart.measures) == 2

    assert chart.measures[0].rows == 4
    assert chart.measures[1].rows == 8
Example #3
0
def test_parse_long_hold():
    chart = parse.parse_chart(LONG_HOLD_CHART)

    assert len(chart.measures) == 2

    assert len(chart.measures[0].notes) == 1
    assert len(chart.measures[1].notes) == 0

    ideal_note = Hold(note_type=Hold.TYPE_ROLL, offset=0, duration=1.5, position=Note.POSITION_DOWN)
    assert chart.measures[0].notes[0] == ideal_note
Example #4
0
def test_parse_chart_measure():
    chart = parse.parse_chart(MEASURE_CHART)

    assert len(chart.measures) == 1

    measure = chart.measures[0]
    assert len(measure.notes) == 4

    required_notes = [
        Tap(position=Note.POSITION_LEFT, note_type=Tap.TYPE_NORMAL, offset=0),
        Tap(position=Note.POSITION_RIGHT, note_type=Tap.TYPE_NORMAL, offset=0),
        Hold(position=Note.POSITION_DOWN, note_type=Hold.TYPE_HOLD, offset=0, duration=1),
        Tap(position=Note.POSITION_UP, note_type=Tap.TYPE_MINE, offset=2)
    ]

    for note in required_notes:
        assert note in measure.notes
Example #5
0
def basic_chart():
    chart = '''
     dance-single:
     foo:
     Beginner:
     3:
     0.135,0.176,0.000,0.000,0.000:
'''
    measures = []
    for i in range(0, N_MEASURES):
        measure = ''
        for i in range(0, 4):
            measure += '0000\n'
        measures.append(measure)

    chart += ',\n'.join(measures)

    return parse.parse_chart(chart)
Example #6
0
def test_parse_multiple_holds():
    chart = parse.parse_chart(MULTI_HOLD_CHART)

    assert len(chart.measures) == 2

    assert len(chart.measures[0].notes) == 2
    assert len(chart.measures[1].notes) == 2

    first_measure_notes = [
        Hold(note_type=Hold.TYPE_ROLL, offset=0, duration=1.5, position=Note.POSITION_DOWN),
        Hold(note_type=Hold.TYPE_HOLD, offset=2, duration=0.5, position=Note.POSITION_UP),
    ]

    second_measure_notes = [
        Hold(note_type=Hold.TYPE_HOLD, offset=1, duration=0.25, position=Note.POSITION_UP),
        Hold(note_type=Hold.TYPE_HOLD, offset=4, duration=0.25, position=Note.POSITION_RIGHT),
    ]

    for note in first_measure_notes:
        assert note in chart.measures[0].notes
    for note in second_measure_notes:
        assert note in chart.measures[1].notes
Example #7
0
def test_parse_chart_attrs():
    chart = parse.parse_chart(ATTR_CHART)

    assert chart.author == 'foo'
    assert chart.difficulty == 'Beginner'
    assert chart.rating == 3