style: Run linter and format test_myanimelist.py for consistency
This commit is contained in:
parent
f492de825e
commit
d8e8704a4a
|
@ -1,19 +1,30 @@
|
|||
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", "サウンドスケーブ"),
|
||||
])
|
||||
|
||||
@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 is not None, f"parse_name returned None for input: {input_str}"
|
||||
assert m is not None, f'parse_name returned None for input: {input_str}'
|
||||
actual_group1 = m.group(1).strip() if m.group(1) is not None else None
|
||||
actual_group2 = m.group(2).strip() if m.group(2) is not None else None
|
||||
assert actual_group1 == expected_group1, f"Expected group(1): {expected_group1} but got: {actual_group1}"
|
||||
assert actual_group1 == expected_group1, (
|
||||
f'Expected group(1): {expected_group1} but got: {actual_group1}'
|
||||
)
|
||||
if expected_group2 is None:
|
||||
assert actual_group2 is None, f"Expected group(2) to be None but got: {actual_group2}"
|
||||
assert actual_group2 is None, (
|
||||
f'Expected group(2) to be None but got: {actual_group2}'
|
||||
)
|
||||
else:
|
||||
assert actual_group2 == expected_group2, f"Expected group(2): {expected_group2} but got: {actual_group2}"
|
||||
assert actual_group2 == expected_group2, (
|
||||
f'Expected group(2): {expected_group2} but got: {actual_group2}'
|
||||
)
|
||||
|
|
Loading…
Reference in New Issue
Block a user