Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Active Branch with specified requirements installed not returning expected results. #785

Open
kevinhayden1 opened this issue Aug 14, 2023 · 1 comment

Comments

@kevinhayden1
Copy link

Describe the bug
Currently, Sportsipy is not working on this branch for even the basic examples on the README.

To Reproduce
The contents of this Unit Test:

from sportsipy.nhl.teams import Teams as NHLTeams
from sportsipy.nba.teams import Teams as NBATeams
from sportsipy.nfl.teams import Teams as NFLTeams
from sportsipy.ncaab.schedule import Schedule as NCAABSchedule
from sportsipy.ncaaf.boxscore import Boxscore as NCAAFBoxscore
from sportsipy.mlb.boxscore import Boxscore as MLBBoxscore
from sportsipy.fb.team import Team as FBTeam


class SportsipyTests(unittest.TestCase):

    def test_nhl_teams_2018(self):
        teams = NHLTeams(2018)
        self.assertTrue(isinstance(teams, NHLTeams))

    def test_nba_team_names_and_abbreviations(self):
        teams = NBATeams()
        for team in teams:
            self.assertTrue(isinstance(team.name, str))
            self.assertTrue(isinstance(team.abbreviation, str))

    def test_nfl_team_information(self):
        teams = NFLTeams()
        lions = teams('DET')
        self.assertTrue(lions)

    def test_ncaab_game_dates(self):
        purdue_schedule = NCAABSchedule('purdue')
        for game in purdue_schedule:
            self.assertTrue(isinstance(game.date, str))

    def test_ncaaf_away_interceptions(self):
        championship_game = NCAAFBoxscore('2018-01-08-georgia')
        self.assertTrue(isinstance(championship_game.away_interceptions, int))

    def test_mlb_game_dataframe(self):
        game = MLBBoxscore('BOS201806070')
        self.assertTrue(hasattr(game, 'dataframe'))

    def test_fb_team_goals(self):
        tottenham = FBTeam('Tottenham Hotspur')
        self.assertTrue(isinstance(tottenham.goals_scored, int))


if __name__ == "__main__":
    unittest.main()

Expected behavior
The expected behavior is for prints, equality found or asserts to be true for the provided test. Currently, these are not returning the expected results.

Screenshots
Screenshot 2023-08-14 122003

As seen in the screenshot, what I have also noticed in additional NBA statistics specific testing, is that the first line is interacting with the data on sports-references.com but nothing is being returned.

Desktop (please complete the following information):

  • OS: Windows 10 Home x64
  • Sportsipy Version: 0.6.0

Additional context
Is the issue possibly related to URI changes on sports-references.com? Is there a simple fix or is this software being made obsolete in favor of a new project of similar design? If needed and relevant, I can provide more tests that show active interaction with the source website but do not reveal results. I appreciate any suggestions or acknowledgement on how to proceed.

@davidjkrause
Copy link

Took a look at your issue. As with most recent issues here, these cases are resolved by my fork at https://github.com/davidjkrause/sportsipy

The only case which fails is the NFL case, and it's because the URL for the 2023 page does not yet have a team list, but you can get a pass by forcing the year to 2022, like

teams = NFLTeams(year=2022)

Output on the slightly modified test.py (adding import unittest and changing NFL year) looks like:

python test.py -v
test_fb_team_goals (__main__.SportsipyTests) ... ok
test_mlb_game_dataframe (__main__.SportsipyTests) ... ok
test_nba_team_names_and_abbreviations (__main__.SportsipyTests) ... ok
test_ncaab_game_dates (__main__.SportsipyTests) ... ok
test_ncaaf_away_interceptions (__main__.SportsipyTests) ... ok
test_nfl_team_information (__main__.SportsipyTests) ... ok
test_nhl_teams_2018 (__main__.SportsipyTests) ... ok

----------------------------------------------------------------------
Ran 7 tests in 4.103s

OK

This particular project does not seem maintained right now, but my fork is mostly working at this point, so feel free to use it as an alternative.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants