Skip to content

Commit

Permalink
Merge pull request #568 from martincham/fix-category-names
Browse files Browse the repository at this point in the history
Complete Basketball Category Acronyms in STATS_MAP
  • Loading branch information
cwendt94 authored Sep 9, 2024
2 parents ee0ba49 + 99a4906 commit 9a87e6e
Show file tree
Hide file tree
Showing 3 changed files with 66 additions and 65 deletions.
62 changes: 31 additions & 31 deletions espn_api/basketball/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
'UT': 11,
'BE': 12,
'IR': 13,
'Rookie': 15
'Rookie': 15,
}

PRO_TEAM_MAP = {
Expand Down Expand Up @@ -75,53 +75,53 @@
'4': 'OREB',
'5': 'DREB',
'6': 'REB',
'7': '7',
'8': '8',
'7': 'EJ',
'8': 'FF',
'9': 'PF',
'10': '10',
'10': 'TF',
'11': 'TO',
'12': '12',
'12': 'DQ',
'13': 'FGM',
'14': 'FGA',
'15': 'FTM',
'16': 'FTA',
'17': '3PTM',
'18': '3PTA',
'17': '3PM',
'18': '3PA',
'19': 'FG%',
'20': 'FT%',
'21': '3PT%',
'22': '22',
'23': '23',
'24': '24',
'25': '25',
'26': '26',
'27': '27',
'22': 'AFG%',
'23': 'FGMI',
'24': 'FTMI',
'25': '3PMI',
'26': 'APG',
'27': 'BPG',
'28': 'MPG',
'29': '29',
'30': '30',
'31': '31',
'32': '32',
'33': '33',
'34': '34',
'35': '35',
'36': '36',
'37': '37',
'38': '38',
'39': '39',
'29': 'PPG',
'30': 'RPG',
'31': 'SPG',
'32': 'TOPG',
'33': '3PG',
'34': 'PPM',
'35': 'A/TO',
'36': 'STR',
'37': 'DD',
'38': 'TD',
'39': 'QD',
'40': 'MIN',
'41': 'GS',
'42': 'GP',
'43': '43',
'44': '44',
'43': 'TW',
'44': 'FTR',
'45': '45',
}
}

STAT_ID_MAP = {
'00': 'total',
'10': 'projected',
'01': 'last_7',
'02': 'last_15',
'03': 'last_30'
'03': 'last_30',
}

ACTIVITY_MAP = {
Expand All @@ -133,17 +133,17 @@
244: 'TRADED',
'FA': 178,
'WAIVER': 180,
'TRADED': 244
'TRADED': 244,
}

NINE_CAT_STATS = {
'3PTM',
'3PM',
'AST',
'BLK',
'FG%',
'FT%',
'PTS',
'REB',
'STL',
'TO'
'TO',
}
60 changes: 30 additions & 30 deletions espn_api/wbasketball/constant.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'F/C': 4,
'UTIL': 5,
'BE': 6,
'IR': 7
'IR': 7,
}

PRO_TEAM_MAP = {
Expand All @@ -43,52 +43,52 @@
'4': 'OREB',
'5': 'DREB',
'6': 'REB',
'7': '',
'8': '',
'7': 'EJ',
'8': 'FF',
'9': 'PF',
'10': '',
'10': 'TF',
'11': 'TO',
'12': '',
'12': 'DQ',
'13': 'FGM',
'14': 'FGA',
'15': 'FTM',
'16': 'FTA',
'17': '3PTM',
'18': '3PTA',
'17': '3PM',
'18': '3PA',
'19': 'FG%',
'20': 'FT%',
'21': '3PT%',
'22': '',
'23': '',
'24': '',
'25': '',
'26': '',
'27': '',
'22': 'AFG%',
'23': 'FGMI',
'24': 'FTMI',
'25': '3PMI',
'26': 'APG',
'27': 'BPG',
'28': 'MPG',
'29': '',
'30': '',
'31': '',
'32': '',
'33': '',
'34': '',
'35': '',
'36': '',
'37': '',
'38': '',
'39': '',
'29': 'PPG',
'30': 'RPG',
'31': 'SPG',
'32': 'TOPG',
'33': '3PG',
'34': 'PPM',
'35': 'A/TO',
'36': 'STR',
'37': 'DD',
'38': 'TD',
'39': 'QD',
'40': 'MIN',
'41': 'GS',
'42': 'GP',
'43': '',
'44': '',
'45': '',
}
'43': 'TW',
'44': 'FTR',
'45': '45',
}

STAT_ID_MAP = {
'10': 'projected',
'01': 'last_7',
'02': 'last_15',
'03': 'last_30'
'03': 'last_30',
}

ACTIVITY_MAP = {
Expand All @@ -100,5 +100,5 @@
244: 'TRADED',
'FA': 178,
'WAIVER': 180,
'TRADED': 244
'TRADED': 244,
}
9 changes: 5 additions & 4 deletions tests/basketball/integration/test_league.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
from unittest import TestCase
from espn_api.basketball import League


# Integration test to make sure ESPN's API didn't change
class LeagueTest(TestCase):
def setUp(self):
self.league = League(411647, 2019)

def test_league_init(self):

self.assertEqual(self.league.scoringPeriodId, 178)
player = self.league.teams[0].roster[0]
self.assertEqual(player.schedule['2']['team'], 'BKN')
Expand All @@ -32,6 +32,7 @@ def test_league_free_agents(self):
free_agents = self.league.free_agents()

self.assertNotEqual(len(free_agents), 0)

def test_player_info(self):
player_id = self.league.teams[0].roster[0].playerId

Expand All @@ -49,10 +50,10 @@ def test_player_info(self):
'AST': 1.4,
'REB': 15.6,
'TO': 2.2,
'3PTM': 0.1,
'3PM': 0.1,
'FG%': 0.533,
'FT%': 0.59
}
'FT%': 0.59,
},
)

def test_league_box_scores(self):
Expand Down

0 comments on commit 9a87e6e

Please sign in to comment.