Skip to content

Commit

Permalink
Add missing positions, new patch version, update tests (#55)
Browse files Browse the repository at this point in the history
Add the `"F"`, `"G-F"`, `"F-C"`, `"G"` positions.

Hopefully, resolves #54
  • Loading branch information
jaebradley committed Nov 18, 2018
1 parent 15cfc0b commit 2bf0a26
Show file tree
Hide file tree
Showing 3 changed files with 159 additions and 6 deletions.
8 changes: 8 additions & 0 deletions basketball_reference_web_scraper/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ class Position(Enum):
POWER_FORWARD = "POWER FORWARD"
CENTER = "CENTER"
FORWARD_GUARD = "FORWARD-GUARD"
FORWARD = "FORWARD"
GUARD_FORWARD = "GUARD-FORWARD"
FORWARD_CENTER = "FORWARD-CENTER"
GUARD = "GUARD"


TEAM_ABBREVIATIONS_TO_TEAM = {
Expand Down Expand Up @@ -122,4 +126,8 @@ class Position(Enum):
"PF": Position.POWER_FORWARD,
"C": Position.CENTER,
"F-G": Position.FORWARD_GUARD,
"F": Position.FORWARD,
"G-F": Position.GUARD_FORWARD,
"F-C": Position.FORWARD_CENTER,
"G": Position.GUARD,
}
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

setuptools.setup(
name="basketball_reference_web_scraper",
version="3.1.1",
version="3.1.2",
author="Jae Bradley",
author_email="jae.b.bradley@gmail.com",
license="MIT",
Expand Down
155 changes: 150 additions & 5 deletions tests/test_integration_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,155 @@ def test_output_json_box_scores_to_memory(self):

self.assertIsNotNone(january_first_box_scores)

def test_2001_season_schedule(self):
schedule = client.season_schedule(season_end_year=2001)
self.assertIsNotNone(schedule)

def test_2002_season_schedule(self):
schedule = client.season_schedule(season_end_year=2002)
self.assertIsNotNone(schedule)

def test_2003_season_schedule(self):
schedule = client.season_schedule(season_end_year=2003)
self.assertIsNotNone(schedule)

def test_2004_season_schedule(self):
schedule = client.season_schedule(season_end_year=2004)
self.assertIsNotNone(schedule)

def test_2005_season_schedule(self):
schedule = client.season_schedule(season_end_year=2005)
self.assertIsNotNone(schedule)

def test_2006_season_schedule(self):
schedule = client.season_schedule(season_end_year=2006)
self.assertIsNotNone(schedule)

def test_2007_season_schedule(self):
schedule = client.season_schedule(season_end_year=2007)
self.assertIsNotNone(schedule)

def test_2008_season_schedule(self):
schedule = client.season_schedule(season_end_year=2008)
self.assertIsNotNone(schedule)

def test_2009_season_schedule(self):
schedule = client.season_schedule(season_end_year=2009)
self.assertIsNotNone(schedule)

def test_2010_season_schedule(self):
player_season_totals = client.season_schedule(season_end_year=2010)
self.assertIsNotNone(player_season_totals)

def test_2011_season_schedule(self):
schedule = client.season_schedule(season_end_year=2011)
self.assertIsNotNone(schedule)

def test_2012_season_schedule(self):
schedule = client.season_schedule(season_end_year=2012)
self.assertIsNotNone(schedule)

def test_2013_season_schedule(self):
schedule = client.season_schedule(season_end_year=2013)
self.assertIsNotNone(schedule)

def test_2014_season_schedule(self):
schedule = client.season_schedule(season_end_year=2014)
self.assertIsNotNone(schedule)

def test_2015_season_schedule(self):
schedule = client.season_schedule(season_end_year=2015)
self.assertIsNotNone(schedule)

def test_2016_season_schedule(self):
schedule = client.season_schedule(season_end_year=2016)
self.assertIsNotNone(schedule)

def test_2017_season_schedule(self):
schedule = client.season_schedule(season_end_year=2017)
self.assertIsNotNone(schedule)

def test_2018_season_schedule(self):
schedule = client.season_schedule(season_end_year=2018)
self.assertIsNotNone(schedule)

# TODO: @jaebradley there's an open PR that's fixing this broken test
# def test_2019_season_schedule(self):
# schedule = client.season_schedule(season_end_year=2019)
# self.assertIsNotNone(schedule)

def test_2001_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2001)
self.assertIsNotNone(player_season_totals)

def test_2002_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2002)
self.assertIsNotNone(player_season_totals)

def test_2003_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2003)
self.assertIsNotNone(player_season_totals)

def test_2004_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2004)
self.assertIsNotNone(player_season_totals)

def test_2005_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2005)
self.assertIsNotNone(player_season_totals)

def test_2006_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2006)
self.assertIsNotNone(player_season_totals)

def test_2007_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2007)
self.assertIsNotNone(player_season_totals)

def test_2008_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2008)
self.assertIsNotNone(player_season_totals)

def test_2009_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2009)
self.assertIsNotNone(player_season_totals)

def test_2010_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2010)
self.assertIsNotNone(player_season_totals)

def test_2011_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2011)
self.assertIsNotNone(player_season_totals)

def test_2012_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2012)
self.assertIsNotNone(player_season_totals)

def test_2013_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2013)
self.assertIsNotNone(player_season_totals)

def test_2014_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2014)
self.assertIsNotNone(player_season_totals)

def test_2015_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2015)
self.assertIsNotNone(player_season_totals)

def test_2016_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2016)
self.assertIsNotNone(player_season_totals)

def test_2017_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2017)
self.assertIsNotNone(player_season_totals)

def test_2018_player_season_totals(self):
now = datetime.now()
current_year = now.year
player_season_totals = client.players_season_totals(season_end_year=2018)
self.assertIsNotNone(player_season_totals)

for year in range(2001, current_year + 1):
player_season_totals = client.players_season_totals(season_end_year=year)
self.assertIsNotNone(player_season_totals)
def test_2019_player_season_totals(self):
player_season_totals = client.players_season_totals(season_end_year=2019)
self.assertIsNotNone(player_season_totals)

0 comments on commit 2bf0a26

Please sign in to comment.