def test_roster_class_string_representation(self, *args, **kwargs): expected = """Jimmy Howard (howarja02) Henrik Zetterberg (zettehe01)""" flexmock(utils) \ .should_receive('_find_year_for_season') \ .and_return('2018') roster = Roster('DET') assert roster.__repr__() == expected
def test_roster_class_pulls_all_player_stats(self, *args, **kwargs): flexmock(utils) \ .should_receive('_find_year_for_season') \ .and_return('2018') roster = Roster('DET') assert len(roster.players) == 2 for player in roster.players: assert player.name in ['Jimmy Howard', 'Henrik Zetterberg']
def test_roster_class_with_slim_parameter(self, *args, **kwargs): flexmock(utils) \ .should_receive('_find_year_for_season') \ .and_return('2018') roster = Roster('DET', slim=True) assert len(roster.players) == 2 assert roster.players == { 'howarja02': 'Jimmy Howard', 'zettehe01': 'Henrik Zetterberg' }
def test_invalid_default_year_reverts_to_previous_year( self, *args, **kwargs): flexmock(utils) \ .should_receive('_find_year_for_season') \ .and_return(2019) roster = Roster('DET') assert len(roster.players) == 2 for player in roster.players: assert player.name in ['Jimmy Howard', 'Henrik Zetterberg']
def test_bad_url_raises_value_error(self, *args, **kwargs): with pytest.raises(ValueError): roster = Roster('bad')
def test_coach(self): assert "Jeff Blashill" == Roster('DET', year=YEAR).coach