def test_pitching_stats_bref_none() -> None: pitching_stats_range_mock = MagicMock() this_year = most_recent_season() with patch('pybaseball.league_pitching_stats.pitching_stats_range', pitching_stats_range_mock): league_pitching_stats.pitching_stats_bref(None) pitching_stats_range_mock.assert_called_once_with(f'{this_year}-03-01', f"{this_year}-11-01")
def test_pitching_stats_bref() -> None: result = league_pitching_stats.pitching_stats_bref(2019) assert result is not None assert not result.empty assert len(result.columns) == 40 assert (len(result)) == 831
def test_pitching_stats_bref_future() -> None: with pytest.raises(IndexError): league_pitching_stats.pitching_stats_bref(most_recent_season() + 1)
def test_pitching_stats_bref_future() -> None: with pytest.raises(IndexError): league_pitching_stats.pitching_stats_bref(datetime.today().year + 1)
def test_pitching_stats_bref_bad_year() -> None: with pytest.raises(ValueError): league_pitching_stats.pitching_stats_bref('NOT A YEAR')