Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 2 additions & 0 deletions src/nba_api/stats/library/parameters.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,6 +709,8 @@ class SeasonType:
regular = "Regular Season"
preseason = "Pre Season"
playin = "PlayIn"
nba_cup = "NBA Cup"
ist = "IST"

default = regular

Expand Down
84 changes: 52 additions & 32 deletions tests/unit/test_parameters.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
from nba_api.stats.library.parameters import (
Season,
SeasonType,
SeasonTypePlayoffs,
SeasonTypeAllStar,
Season,
SeasonType,
SeasonTypePlayoffs,
SeasonTypeAllStar,
SeasonTypeNullable,
SeasonTypeAllStarNullable,
_NotRequired
_NotRequired,
)
import re

Expand All @@ -18,25 +18,33 @@ def test_season_type_base():
assert SeasonType.regular == "Regular Season"
assert SeasonType.preseason == "Pre Season"
assert SeasonType.playin == "PlayIn"
assert SeasonType.nba_cup == "NBA Cup"
assert SeasonType.ist == "IST"
assert SeasonType.default == "Regular Season"
assert hasattr(SeasonType, 'regular')
assert hasattr(SeasonType, 'preseason')
assert hasattr(SeasonType, 'playin')
assert not hasattr(SeasonType, 'playoffs')
assert not hasattr(SeasonType, 'all_star')
assert hasattr(SeasonType, "regular")
assert hasattr(SeasonType, "preseason")
assert hasattr(SeasonType, "playin")
assert hasattr(SeasonType, "nba_cup")
assert hasattr(SeasonType, "ist")
assert not hasattr(SeasonType, "playoffs")
assert not hasattr(SeasonType, "all_star")


def test_season_type_playoffs():
assert SeasonTypePlayoffs.regular == "Regular Season"
assert SeasonTypePlayoffs.preseason == "Pre Season"
assert SeasonTypePlayoffs.playoffs == "Playoffs"
assert SeasonTypePlayoffs.playin == "PlayIn"
assert SeasonTypePlayoffs.nba_cup == "NBA Cup"
assert SeasonTypePlayoffs.ist == "IST"
assert SeasonTypePlayoffs.default == "Regular Season"
assert hasattr(SeasonTypePlayoffs, 'regular')
assert hasattr(SeasonTypePlayoffs, 'preseason')
assert hasattr(SeasonTypePlayoffs, 'playoffs')
assert hasattr(SeasonTypePlayoffs, 'playin')
assert not hasattr(SeasonTypePlayoffs, 'all_star')
assert hasattr(SeasonTypePlayoffs, "regular")
assert hasattr(SeasonTypePlayoffs, "preseason")
assert hasattr(SeasonTypePlayoffs, "playoffs")
assert hasattr(SeasonTypePlayoffs, "playin")
assert hasattr(SeasonTypePlayoffs, "nba_cup")
assert hasattr(SeasonTypePlayoffs, "ist")
assert not hasattr(SeasonTypePlayoffs, "all_star")


def test_season_type_all_star():
Expand All @@ -45,42 +53,54 @@ def test_season_type_all_star():
assert SeasonTypeAllStar.playoffs == "Playoffs"
assert SeasonTypeAllStar.playin == "PlayIn"
assert SeasonTypeAllStar.all_star == "All Star"
assert SeasonTypeAllStar.nba_cup == "NBA Cup"
assert SeasonTypeAllStar.ist == "IST"
assert SeasonTypeAllStar.default == "Regular Season"
assert hasattr(SeasonTypeAllStar, 'regular')
assert hasattr(SeasonTypeAllStar, 'preseason')
assert hasattr(SeasonTypeAllStar, 'playoffs')
assert hasattr(SeasonTypeAllStar, 'playin')
assert hasattr(SeasonTypeAllStar, 'all_star')
assert hasattr(SeasonTypeAllStar, "regular")
assert hasattr(SeasonTypeAllStar, "preseason")
assert hasattr(SeasonTypeAllStar, "playoffs")
assert hasattr(SeasonTypeAllStar, "playin")
assert hasattr(SeasonTypeAllStar, "all_star")
assert hasattr(SeasonTypeAllStar, "nba_cup")
assert hasattr(SeasonTypeAllStar, "ist")


def test_season_type_nullable():
assert SeasonTypeNullable.regular == "Regular Season"
assert SeasonTypeNullable.preseason == "Pre Season"
assert SeasonTypeNullable.playoffs == "Playoffs"
assert SeasonTypeNullable.playin == "PlayIn"
assert SeasonTypeNullable.nba_cup == "NBA Cup"
assert SeasonTypeNullable.ist == "IST"
assert SeasonTypeNullable.none == ""
assert SeasonTypeNullable.default == ""
assert hasattr(SeasonTypeNullable, 'regular')
assert hasattr(SeasonTypeNullable, 'preseason')
assert hasattr(SeasonTypeNullable, 'playoffs')
assert hasattr(SeasonTypeNullable, 'playin')
assert hasattr(SeasonTypeNullable, 'none')
assert not hasattr(SeasonTypeNullable, 'all_star')
assert hasattr(SeasonTypeNullable, "regular")
assert hasattr(SeasonTypeNullable, "preseason")
assert hasattr(SeasonTypeNullable, "playoffs")
assert hasattr(SeasonTypeNullable, "playin")
assert hasattr(SeasonTypeNullable, "nba_cup")
assert hasattr(SeasonTypeNullable, "ist")
assert hasattr(SeasonTypeNullable, "none")
assert not hasattr(SeasonTypeNullable, "all_star")


def test_season_type_all_star_nullable():
assert SeasonTypeAllStarNullable.regular == "Regular Season"
assert SeasonTypeAllStarNullable.preseason == "Pre Season"
assert SeasonTypeAllStarNullable.playoffs == "Playoffs"
assert SeasonTypeAllStarNullable.playin == "PlayIn"
assert SeasonTypeAllStarNullable.nba_cup == "NBA Cup"
assert SeasonTypeAllStarNullable.ist == "IST"
assert SeasonTypeAllStarNullable.none == ""
assert SeasonTypeAllStarNullable.default == ""
assert hasattr(SeasonTypeAllStarNullable, 'regular')
assert hasattr(SeasonTypeAllStarNullable, 'preseason')
assert hasattr(SeasonTypeAllStarNullable, 'playoffs')
assert hasattr(SeasonTypeAllStarNullable, 'playin')
assert hasattr(SeasonTypeAllStarNullable, 'none')
assert not hasattr(SeasonTypeAllStarNullable, 'all_star')
assert hasattr(SeasonTypeAllStarNullable, "regular")
assert hasattr(SeasonTypeAllStarNullable, "preseason")
assert hasattr(SeasonTypeAllStarNullable, "playoffs")
assert hasattr(SeasonTypeAllStarNullable, "playin")
assert hasattr(SeasonTypeAllStarNullable, "nba_cup")
assert hasattr(SeasonTypeAllStarNullable, "ist")
assert hasattr(SeasonTypeAllStarNullable, "none")
assert not hasattr(SeasonTypeAllStarNullable, "all_star")


def test_season_type_inheritance():
Expand Down