import pytest from personal_data.fetchers.myanimelist import parse_name @pytest.mark.parametrize( 'input_str, expected_group1, expected_group2', [ ('"Soundscape"', 'Soundscape', None), ('"Soundscape (サウンドスケープ)"', 'Soundscape', 'サウンドスケープ'), ('1: "Soundscape"', 'Soundscape', None), ('2: "Soundscape (サウンドスケープ)"', 'Soundscape', 'サウンドスケープ'), ], ) def test_parse_name(input_str, expected_group1, expected_group2): m = parse_name(input_str) assert m.group(1) == expected_group1 assert m.group(2) == expected_group2