-
Notifications
You must be signed in to change notification settings - Fork 564
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #70 from rsforbes/master
Updates to PlaybyPlay Regex. Added Integration Tests to Validate Game PlaybyPlay Data
- Loading branch information
Showing
7 changed files
with
587 additions
and
492 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
import pytest | ||
from collections import defaultdict | ||
from nba_api.stats.library.eventmsgtype import EventMsgType | ||
|
||
playbyplay = defaultdict(list) | ||
|
||
#Block | ||
playbyplay["Block"].append({"description" : "Collins BLOCK (1 BLK)", "player" : "Collins", "blocks" : "1"}) | ||
|
||
#Ejection | ||
playbyplay["Ejection"].append({"description" : "Robinson Ejection:Second Technical", "player" : "Robinson", "ejection_type" : "Second Technical"}) | ||
|
||
#Field Goal Made (With Assist) | ||
playbyplay["FieldGoalMade"].append({"description" : "S. Hill 24' 3PT Jump Shot (3 PTS) (Mahinmi 1 AST)", "player" : "S. Hill", "distance" : "24", "field_goal_type" : "3PT Jump Shot", "points" : "3", "player_ast" : "Mahinmi", "assists" : "1"}) | ||
|
||
#Field Goal Made (Without Assist) | ||
playbyplay["FieldGoalMade"].append({"description" : "Aldridge 6' Turnaround Hook Shot (8 PTS)", "player" : "Aldridge", "distance" : "6", "field_goal_type" : "Turnaround Hook Shot", "points" : "8", "player_ast" : None, "assists" : None}) | ||
|
||
#Field Goal Made (Without Distance) | ||
playbyplay["FieldGoalMade"].append({"description" : "Broekhoff 3PT Jump Shot (3 PTS) (Lee 2 AST)", "player" : "Broekhoff", "distance" : None, "field_goal_type" : "3PT Jump Shot", "points" : "3", "player_ast" : "Lee", "assists" : "2"}) | ||
|
||
#Field Goal Missed | ||
playbyplay["FieldGoalMissed"].append({"description" : "MISS O'Quinn 17' Jump Shot", "player" : "O'Quinn", "distance" : "17", "field_goal_type" : "Jump Shot"}) | ||
|
||
#Foul Player | ||
playbyplay["FoulPlayer"].append({"description" : "Collison P.FOUL (P1.TN) (M.Lindsay)", "player" : "Collison", "foul_type" : "P.FOUL", "personal" : "1", "team" : "N", "referee" : "M.Lindsay"}) | ||
|
||
#Foul Player (Long Referee Name) | ||
playbyplay["FoulPlayer"].append({"description" : "Allen P.FOUL (P1.T3) (J.Van Duyne)", "player" : "Allen", "foul_type" : "P.FOUL", "personal" : "1", "team" : "3", "referee" : "J.Van Duyne"}) | ||
|
||
#Foul Team | ||
playbyplay["FoulTeam"].append({"description" : "BUCKS T.Foul (Def. 3 Sec Lopez ) (M.Callahan)", "team" : "BUCKS", "foul_type" : "Def. 3 Sec", "player" : "Lopez", "referee" : "M.Callahan"}) | ||
|
||
#Free Throw Made | ||
playbyplay["FreeThrowMade"].append({"description" : "Sumner Free Throw 2 of 2 (1 PTS)", "player" : "Sumner", "free_throw_type" : "2 of 2", "points" : "1"}) | ||
|
||
#Free Throw Made (Clear Path 1 of 2) | ||
playbyplay["FreeThrowMade"].append({"description" : "Powell Free Throw Clear Path 1 of 2 (18 PTS)", "player" : "Powell", "free_throw_type" : "Clear Path 1 of 2", "points" : "18"}) | ||
|
||
#Free Throw Missed | ||
playbyplay["FreeThrowMissed"].append({"description" : "MISS Prince Free Throw 1 of 2", "player" : "Prince", "free_throw_type" : "1 of 2"}) | ||
|
||
#Jump Ball | ||
playbyplay["JumpBall"].append({"description" : "Jump Ball Collins vs. O'Quinn: Tip to Leaf", "player_home" : "Collins", "player_away" : "O'Quinn", "player_tip" : "Leaf"}) | ||
|
||
#Jump Ball (Without player_tip) | ||
playbyplay["JumpBall"].append({"description" : "Jump Ball Green vs. McKinnie: Tip to", "player_home" : "Green", "player_away" : "McKinnie", "player_tip" : None}) | ||
|
||
#Player (Single Name) | ||
playbyplay["Player"].append({"description" : "Millsap 25' 3PT Jump Shot (9 PTS) (Teague 1 AST)", "player" : "Millsap"}) | ||
|
||
#Player (Hyphenated Name) | ||
playbyplay["Player"].append({"description" : "Bates-Diop P.FOUL (P1.T4) (M.Boland)", "player" : "Bates-Diop"}) | ||
|
||
#Player (Apostrophe) | ||
playbyplay["Player"].append({"description" : "O'Quinn 20' Jump Shot (2 PTS) (Oladipo 1 AST)", "player" : "O'Quinn"}) | ||
|
||
#Player (First Initial dot Last Name) | ||
playbyplay["Player"].append({"description" : "S. Hill 24' 3PT Jump Shot (3 PTS) (Mahinmi 1 AST)", "player" : "S. Hill"}) | ||
|
||
#Player (Junior) | ||
playbyplay["Player"].append({"description" : "Porter Jr. 10' Driving Floating Jump Shot (2 PTS)", "player" : "Porter Jr."}) | ||
|
||
#Player (Second) | ||
playbyplay["Player"].append({"description" : "Payton II 2' Driving Reverse Layup (2 PTS) (Middleton 6 AST)", "player" : "Payton II"}) | ||
|
||
#Player (Third) | ||
playbyplay["Player"].append({"description" : "Robinson III Free Throw 1 of 1 (3 PTS)", "player" : "Robinson III"}) | ||
|
||
#Player (Fourth) | ||
playbyplay["Player"].append({"description" : "Walker IV REBOUND (Off:0 Def:1)", "player" : "Walker IV"}) | ||
|
||
#Rebound Player | ||
playbyplay["ReboundPlayer"].append({"description" : "Zubac REBOUND (Off:2 Def:4)", "player" : "Zubac", "offensive" : "2", "defensive" : "4"}) | ||
|
||
#Rebound Team (One Word) | ||
playbyplay["ReboundTeam"].append({"description" : "Timberwolves Rebound", "team" : "Timberwolves"}) | ||
|
||
#Rebound Team (Two Words) | ||
playbyplay["ReboundTeam"].append({"description" : "TRAIL BLAZERS Rebound", "team" : "TRAIL BLAZERS"}) | ||
|
||
#Steal | ||
playbyplay["Steal"].append({"description" : "Bradley STEAL (2 STL)", "player" : "Bradley", "steals" : "2"}) | ||
|
||
#Substitution | ||
playbyplay["Substitution"].append({"description" : "SUB: Sefolosha FOR Ingles", "player_in" : "Sefolosha", "player_out" : "Ingles"}) | ||
|
||
#Timeout | ||
playbyplay["Timeout"].append({"description" : "TRAIL BLAZERS Timeout: Regular (Full 5 Short 0)", "team" : "TRAIL BLAZERS", "timeout_type" : "Regular", "full" : "5", "short" : "0"}) | ||
|
||
#Turnover Player | ||
playbyplay["TurnoverPlayer"].append({"description" : "G. Harrison Double Dribble Turnover (P1.T10)", "player" : "G. Harrison", "turnover_type" : "Double Dribble", "personal" : "1", "team" : "10"}) | ||
|
||
#Turnover Team (less than 10) | ||
playbyplay["TurnoverTeam"].append({"description" : "NUGGETS Turnover: Shot Clock (T#12)", "team" : "NUGGETS", "turnover_type" : "Shot Clock", "turnovers" : "12"}) | ||
|
||
#Turnover Team (greater than 9) | ||
playbyplay["TurnoverTeam"].append({"description" : "NETS Turnover: Shot Clock (T#6)", "team" : "NETS", "turnover_type" : "Shot Clock", "turnovers" : "6"}) | ||
|
||
#Turnover Team (turnover_type starts with digit) | ||
playbyplay["TurnoverTeam"].append({"description" : "WIZARDS Turnover: 5 Second Violation (T#12)", "team" : "WIZARDS", "turnover_type" : "5 Second Violation", "turnovers" : "12"}) | ||
|
||
#Violation | ||
playbyplay["Violation"].append({"description" : "Dieng Violation:Kicked Ball (T.Brown)", "player" : "Dieng", "violation_type" : "Kicked Ball", "referee" : "T.Brown"}) | ||
|
Oops, something went wrong.