def test_mlb_bad_int_property_returns_default(self): flexmock(Team) \ .should_receive('_parse_team_data') \ .and_return(None) team = Team(None, 1) fake_record = PropertyMock(return_value='Bad-Bad') type(team)._extra_inning_record = fake_record assert team.extra_inning_wins is None
def test_mlb_schedule_returns_schedule(self, *args, **kwargs): flexmock(Team) \ .should_receive('_parse_team_data') \ .and_return(None) flexmock(Schedule) \ .should_receive('_pull_schedule') \ .and_return(None) team = Team(None, 1) assert len(team.schedule) == 0
def test_roster_from_team_class(self, *args, **kwargs): flexmock(Team) \ .should_receive('_parse_team_data') \ .and_return(None) team = Team(None, 1, '2018') mock_abbreviation = mock.PropertyMock(return_value='HOU') type(team)._abbreviation = mock_abbreviation assert len(team.roster.players) == 3 for player in team.roster.players: assert player.name in [u'José Altuve', 'Justin Verlander', 'Charlie Morton'] type(team)._abbreviation = None
def test_pulling_team_directly(self, *args, **kwargs): hou = Team('HOU') for attribute, value in self.results.items(): assert getattr(hou, attribute) == value
def test_mlb_team_string_representation(self): hou = Team('HOU') assert hou.__repr__() == 'Houston Astros (HOU) - 2017'