This repository has been archived by the owner on Nov 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 256
Fix/tracking #94
Open
danchyy
wants to merge
4
commits into
seemethere:master
Choose a base branch
from
danchyy:fix/tracking
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Fix/tracking #94
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
d06af0f
Added constants for tracking which are available at nba
danchyy b694f73
Added pt_measure_type as parameter for player tracking stats, if not …
danchyy 76b75c3
Changed test to fit refactored code and added another test to check w…
danchyy a77b1f3
Idented with extra line
danchyy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from nba_py import league | ||
from nba_py import constants | ||
try: | ||
# python 2 compatability | ||
from future_builtins import filter | ||
except ImportError: | ||
pass | ||
|
||
class TestPlayerTrackingStats: | ||
|
||
def __init__(self): | ||
self.season = "2016-17" | ||
self.target_player = "Aaron Gordon" | ||
|
||
def testPassing(self): | ||
passing = league.PlayerTrackingStats(season=self.season, pt_measure_type=constants.PtMeasureType.Passing) | ||
assert passing | ||
overall = passing.overall() | ||
stats = overall.iloc[2] | ||
assert stats['PLAYER_NAME'] == self.target_player | ||
assert stats['GP'] == 80 | ||
assert stats['AST_TO_PASS_PCT_ADJ'] == 0.102 | ||
assert stats['AST_ADJ'] == 2.6 | ||
|
||
def testDefense(self): | ||
defense = league.PlayerTrackingStats(season=self.season, pt_measure_type=constants.PtMeasureType.Defense) | ||
assert defense | ||
overall = defense.overall() | ||
stats = overall.iloc[2] | ||
assert stats['PLAYER_NAME'] == self.target_player | ||
assert stats['GP'] == 80 | ||
assert stats['DREB'] == 3.6 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In my opinion, rewriting it to UnitTests usage would be a great idea.