def test_air_by_date_parsing(p, monkeypatch_function_return, create_tvshow): monkeypatch_function_return(p['mocks']) parser = NameParser() guess = guessit.guessit(p['name']) result = parser.to_parse_result(p['name'], guess) # confirm passed in show object indexer id matches result show object indexer id result.series = create_tvshow(name=p['series_info']['name']) actual = parser._parse_anime(result) expected = p['expected'] assert expected == actual
def test_anime_parsing(p, create_tvshow, monkeypatch_function_return): """Test the function medusa.name_parser.NameParser().parser, for a number of (scene/non-scene) numbered anime shows. :p: List of parameters to test with. :create_tvshow: Fixture injected for creating a mock TvShow object. Found in conftest.py. :monkeypatch_function_return: Fixture to monkeypatch a list of tuples (configured through the pytest.mark.parameterize config) """ monkeypatch_function_return(p['mocks']) parser = NameParser() guess = guessit.guessit(p['name'], dict(show_type='anime')) result = parser.to_parse_result(p['name'], guess) # confirm passed in show object indexer id matches result show object indexer id result.series = create_tvshow(name=p['series_info']['name']) result.series.scene = p['series_info']['is_scene'] actual = parser._parse_anime(result) expected = p['expected'] assert expected == actual