def test_get_mod_from_text_returns_nomod_when_no_mod_is_given(self): expected_mods_int = 0 expected_mods_text = "" for beatmap_link in self.beatmap_links: content = f'{beatmap_link}' mods_int, mods_text = get_mod_from_text(content, beatmap_link) self.assertEqual(expected_mods_int, mods_int) self.assertEqual(expected_mods_text, mods_text)
def test_get_mod_from_text_returns_omits_multiple_of_same_mods(self): expected_mods_int = 64 + 8 expected_mods_text = "+HDDT" for beatmap_link in self.beatmap_links: content = f'{beatmap_link} +HD +HDDT +DT' mods_int, mods_text = get_mod_from_text(content, beatmap_link) self.assertEqual(expected_mods_int, mods_int) self.assertEqual(expected_mods_text, mods_text)
def test_get_mod_from_text_returns_correct_mod_combination_when_spaced_with_beatmap_link( self): expected_mods_int = 16 + 8 expected_mods_text = "+HRHD" for beatmap_link in self.beatmap_links: content = f'{beatmap_link} +HRHD' mods_int, mods_text = get_mod_from_text(content, beatmap_link) self.assertEqual(expected_mods_int, mods_int) self.assertEqual(expected_mods_text, mods_text)
def test_get_mod_from_text_returns_correct_mod_combination_when_no_spaces( self): expected_mods_int = 8 + 64 expected_mods_text = "+HDDT" for beatmap_link in self.beatmap_links: content = f'{beatmap_link}+HDDT' mods_int, mods_text = get_mod_from_text(content, beatmap_link) self.assertEqual(expected_mods_int, mods_int) self.assertEqual(expected_mods_text, mods_text)
def test_get_mod_from_text_returns_correct_mod_combination_when_mod_is_case_insensitive( self): expected_mods_int = 64 + 8 expected_mods_text = "+HDDT" for beatmap_link in self.beatmap_links: content = f'{beatmap_link} +HdDt' mods_int, mods_text = get_mod_from_text(content, beatmap_link) self.assertEqual(expected_mods_int, mods_int) self.assertEqual(expected_mods_text, mods_text)
def test_get_mod_from_text_returns_correct_mod_combination_when_mod_is_given_without_plus_sign( self): expected_mods_int = 64 + 8 expected_mods_text = "+HDDT" for beatmap_link in self.beatmap_links: content = f'{beatmap_link} HDDT' mods_int, mods_text = get_mod_from_text(content, beatmap_link) self.assertEqual(expected_mods_int, mods_int) self.assertEqual(expected_mods_text, mods_text)
def test_get_mod_from_text_returns_correct_mod_combination_when_multiple_plus_mod_given( self): expected_mods_int = 64 + 16 + 8 expected_mods_text = "+HDDTHR" for beatmap_link in self.beatmap_links: content = f'{beatmap_link} +HD +DT +HR' mods_int, mods_text = get_mod_from_text(content, beatmap_link) self.assertEqual(expected_mods_int, mods_int) self.assertEqual(expected_mods_text, mods_text)