Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

Fix/tracking #94

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tests/test_nba_py_league.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
class TestPlayerSpeedDistanceTracking:

def test_overall(self):
speed = league.PlayerSpeedDistanceTracking(date_from='03/05/2016',
# default is SpeedDistance tracking
speed = league.PlayerTrackingStats(date_from='03/05/2016',
date_to='03/05/2016', season="2015-16")
assert speed
overall = speed.overall()
Expand Down
32 changes: 32 additions & 0 deletions tests/test_nba_py_tracking.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from nba_py import league
Copy link

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.

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