From 91ad789d106f86da53fb5c6f24b77de726fb9fdf Mon Sep 17 00:00:00 2001 From: Viv Date: Thu, 29 Jun 2023 19:43:48 -0400 Subject: [PATCH] `tests/`: Don't halt early if there's a len(notes) mistmatch --- testing/test_conversion.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/testing/test_conversion.py b/testing/test_conversion.py index df1f4a9..9b3bf64 100644 --- a/testing/test_conversion.py +++ b/testing/test_conversion.py @@ -84,12 +84,14 @@ def test_converted_tja_vs_cached_fumen(id_song, tmp_path, entry_point): for i_branch in ['normal', 'advanced', 'master']: co_branch = co_measure[i_branch] ca_branch = ca_measure[i_branch] - assert_song_property(co_branch, ca_branch, 'length', i_measure, i_branch) # NB: We check for branching before checking speed as fumens store speed changes even for empty branches if co_branch['length'] == 0: continue assert_song_property(co_branch, ca_branch, 'speed', i_measure, i_branch) - for i_note in range(co_branch['length']): + # NB: We could assert that len(notes) is the same for both songs, then iterate through zipped notes. + # But, if there is a mismatched number of notes, we want to know _where_ it occurs. So, we let the + # comparison go on using the max length of both branches until something else fails. + for i_note in range(max([co_branch['length'], ca_branch['length']])): co_note = co_branch[i_note] ca_note = ca_branch[i_note] assert_song_property(co_note, ca_note, 'type', i_measure, i_branch, i_note, func=normalize_type)