1
0
mirror of synced 2025-01-23 14:52:06 +01:00

testing/: Add test case for missing balloons

This commit is contained in:
Viv 2023-07-23 12:15:05 -04:00
parent a979b4104a
commit cee3819efa
5 changed files with 61 additions and 5 deletions

View File

@ -52,13 +52,15 @@ def split_tja_lines_into_courses(lines):
# Course-specific header fields
elif name_upper == 'COURSE':
if value not in NORMALIZE_COURSE.keys():
raise ValueError(f"Invalid COURSE value: '{value}'")
current_course = NORMALIZE_COURSE[value]
current_course_cached = current_course
if current_course not in parsed_tja.courses.keys():
raise ValueError()
elif name_upper == 'LEVEL':
parsed_tja.courses[current_course].level = \
int(value) if value else 0
if value not in ['1', '2', '3', '4', '5',
'6', '7', '8', '9', '10']:
raise ValueError(f"Invalid LEVEL value: '{value}")
parsed_tja.courses[current_course].level = int(value)
elif name_upper == 'SCOREINIT':
parsed_tja.courses[current_course].score_init = \
int(value.split(",")[-1]) if value else 0

View File

@ -0,0 +1,17 @@
// This song contains only basic notes.
BPM:120
OFFSET:-1.00
COURSE:
LEVEL:10
BALLOON:8,8
SCOREINIT:400
SCOREDIFF:100
#START
1020304,
5000008,
6000008,
7000008,
9000008,
#END

View File

@ -0,0 +1,17 @@
// This song contains only basic notes.
BPM:120
OFFSET:-1.00
COURSE:Oni
LEVEL:
BALLOON:8,8
SCOREINIT:400
SCOREDIFF:100
#START
1020304,
5000008,
6000008,
7000008,
9000008,
#END

View File

@ -0,0 +1,17 @@
// This song is missing `SCOREINIT:` and `SCOREDIFF:` metadata
BPM:120
OFFSET:-1.00
COURSE:Oni
LEVEL:10
BALLOON:8,8
SCOREINIT:
SCOREDIFF:
#START
1020304,
5000008,
6000008,
7000008,
9000008,
#END

View File

@ -8,7 +8,10 @@ from conftest import convert
@pytest.mark.parametrize('id_song,err_msg', [
['basic_song', None],
['missing_balloon', "Not enough values for 'BALLOON:"]
['missing_score', None],
['missing_balloon', "Not enough values for 'BALLOON:"],
['missing_course', "Invalid COURSE value:"],
['missing_level', "Invalid LEVEL value:"]
])
def test_expected_errors(id_song, err_msg, tmp_path, entry_point):
# Define the testing directory