예제 #1
0
    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
예제 #2
0
    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']
예제 #3
0
    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'
        }
예제 #4
0
    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']
예제 #5
0
 def test_bad_url_raises_value_error(self, *args, **kwargs):
     with pytest.raises(ValueError):
         roster = Roster('bad')
예제 #6
0
 def test_coach(self):
     assert "Jeff Blashill" == Roster('DET', year=YEAR).coach