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

Added PlayByPlay Regex for Ejections. Restructured PlayByPlay Tests. #64

Merged
merged 1 commit into from
Apr 21, 2019

Conversation

rsforbes
Copy link
Collaborator

@rsforbes rsforbes commented Apr 19, 2019

Grouped tests for PlayByPlay into folder. Separated out data from tests to be more inclusive of disparate data that is identified throughout the PlayByPlay feed.

TestData is structured into a collections.defaultdict. This allows the data to be looked up by a key (e.g. FieldGoalMade). The values are stored as a k:v pair that work against the description key/value which contains the actual play as presented by the NBA. The other key\values correspond to the regex capture groups.

Overall, this will make testing much easier as new data is found and regex is modified to accommodate.

EXAMPLES OF DIFFERENT DATA:

#Field Goal Made (With Assist)
data["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)
data["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)
data["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"})

…ayregex to conftest.py. Added additional regex unit tests. Moved tests into PlayByPlay folder
@swar swar merged commit ad5f506 into swar:master Apr 21, 2019
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

Successfully merging this pull request may close these issues.

2 participants