testing/
: Add test case for missing balloons
This commit is contained in:
parent
a979b4104a
commit
cee3819efa
@ -52,13 +52,15 @@ def split_tja_lines_into_courses(lines):
|
|||||||
|
|
||||||
# Course-specific header fields
|
# Course-specific header fields
|
||||||
elif name_upper == 'COURSE':
|
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 = NORMALIZE_COURSE[value]
|
||||||
current_course_cached = current_course
|
current_course_cached = current_course
|
||||||
if current_course not in parsed_tja.courses.keys():
|
|
||||||
raise ValueError()
|
|
||||||
elif name_upper == 'LEVEL':
|
elif name_upper == 'LEVEL':
|
||||||
parsed_tja.courses[current_course].level = \
|
if value not in ['1', '2', '3', '4', '5',
|
||||||
int(value) if value else 0
|
'6', '7', '8', '9', '10']:
|
||||||
|
raise ValueError(f"Invalid LEVEL value: '{value}")
|
||||||
|
parsed_tja.courses[current_course].level = int(value)
|
||||||
elif name_upper == 'SCOREINIT':
|
elif name_upper == 'SCOREINIT':
|
||||||
parsed_tja.courses[current_course].score_init = \
|
parsed_tja.courses[current_course].score_init = \
|
||||||
int(value.split(",")[-1]) if value else 0
|
int(value.split(",")[-1]) if value else 0
|
||||||
|
17
testing/data/dummy_tjas/missing_course.tja
Normal file
17
testing/data/dummy_tjas/missing_course.tja
Normal 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
|
17
testing/data/dummy_tjas/missing_level.tja
Normal file
17
testing/data/dummy_tjas/missing_level.tja
Normal 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
|
17
testing/data/dummy_tjas/missing_score.tja
Normal file
17
testing/data/dummy_tjas/missing_score.tja
Normal 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
|
@ -8,7 +8,10 @@ from conftest import convert
|
|||||||
|
|
||||||
@pytest.mark.parametrize('id_song,err_msg', [
|
@pytest.mark.parametrize('id_song,err_msg', [
|
||||||
['basic_song', None],
|
['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):
|
def test_expected_errors(id_song, err_msg, tmp_path, entry_point):
|
||||||
# Define the testing directory
|
# Define the testing directory
|
||||||
|
Loading…
x
Reference in New Issue
Block a user