Skip to content

Commit

Permalink
add values to conftest and fix divisions in league settings
Browse files Browse the repository at this point in the history
  • Loading branch information
uberfastman committed Sep 13, 2023
1 parent 3df4b40 commit 8ef1212
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 9 deletions.
46 changes: 39 additions & 7 deletions test/integration/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,12 @@ def season() -> int:
"""Set Yahoo Fantasy Sports season for testing."""

# season = 2012
# season = 2013
# season = 2014
# season = 2015
# season = 2016
# season = 2017
# season = 2018
# season = 2019
# season = 2020
# season = 2021
Expand All @@ -97,10 +101,11 @@ def chosen_week() -> int:
def chosen_date() -> str:
"""Set Yahoo Fantasy Sports chosen date for testing."""

chosen_date = "2013-04-15" # NHL - 2013 (for 2012)
# chosen_date = "2013-04-16" # NHL - 2013
# chosen_date = "2021-10-25" # NHL - 2021
# HOCKEY
# chosen_date = "2013-04-15" # NHL - 2013 (for 2012 season)
chosen_date = "2021-10-25" # NHL - 2021

# BASEBALL
# chosen_date = "2021-04-01" # MLB - 2021
# chosen_date = "2022-04-10" # MLB - 2022

Expand All @@ -111,15 +116,19 @@ def chosen_date() -> str:
def league_id() -> str:
"""Set Yahoo Fantasy Sports league ID for testing."""

# league_id = "907359" # NFL - 2015 (testing for league with divisions)
# FOOTBALL
# league_id = "907359" # NFL - 2015 (divisions)
# league_id = "79230" # NFL - 2019
# league_id = "655434" # NFL - 2020
# league_id = "413954" # NFL - 2021
# league_id = "791337" # NFL - 2022 (divisions)
league_id = "321958" # NFL - 2023

# HOCKEY
# league_id = "69624" # NHL - 2012
# league_id = "101592" # NHL - 2021

# BASEBALL
# league_id = "40134" # MLB - 2021

return league_id
Expand All @@ -129,16 +138,23 @@ def league_id() -> str:
def game_id() -> int:
"""Set Yahoo Fantasy Sports game ID for testing."""

# FOOTBALL
# game_id = 331 # NFL - 2014
# game_id = 348 # NFL - 2015 (testing for league with divisions)
# game_id = 348 # NFL - 2015 (divisions)
# game_id = 359 # NFL - 2016
# game_id = 371 # NFL - 2017
# game_id = 380 # NFL - 2018
# game_id = 390 # NFL - 2019
# game_id = 399 # NFL - 2020
# game_id = 406 # NFL - 2021
# game_id = 414 # NFL - 2022 (divisions)
game_id = 423 # NFL - 2023

# HOCKEY
# game_id = 303 # NHL - 2012
# game_id = 411 # NHL - 2021

# BASEBALL
# game_id = 404 # MLB - 2021
# game_id = 412 # MLB - 2022

Expand All @@ -149,16 +165,23 @@ def game_id() -> int:
def game_key() -> str:
"""Set Yahoo Fantasy Sports game key for testing."""

# FOOTBALL
# game_key = "331" # NFL - 2014
# game_key = "348" # NFL - 2015 (testing for league with divisions)
# game_key = "348" # NFL - 2015 (divisions)
# game_key = "359" # NFL - 2016
# game_key = "371" # NFL - 2017
# game_key = "380" # NFL - 2018
# game_key = "390" # NFL - 2019
# game_key = "399" # NFL - 2020
# game_key = "406" # NFL - 2021
# game_key = "414" # NFL - 2022 (divisions)
game_key = "423" # NFL - 2023

# HOCKEY
# game_key = "303" # NHL - 2012
# game_key = "411" # NHL - 2021

# BASEBALL
# game_key = "404" # MLB - 2021
# game_key = "412" # MLB - 2022

Expand All @@ -169,10 +192,13 @@ def game_key() -> str:
def game_code() -> str:
"""Set Yahoo Fantasy Sports game code for testing."""

# FOOTBALL
game_code = "nfl" # NFL

# HOCKEY
# game_code = "nhl" # NHL

# BASEBALL
# game_code = "mlb" # MLB

return game_code
Expand All @@ -182,8 +208,10 @@ def game_code() -> str:
def team_id() -> int:
"""Set Yahoo Fantasy Sports team ID for testing."""

# FOOTBALL
team_id = 1 # NFL

# HOCKEY
# team_id = 2 # NHL (2012)

return team_id
Expand All @@ -193,8 +221,10 @@ def team_id() -> int:
def team_name() -> str:
"""Set Yahoo Fantasy Sports team name for testing."""

# FOOTBALL
team_name = "Legion" # NFL

# HOCKEY
# team_name = "The Bateleurs" # NHL (2012)

return team_name
Expand All @@ -204,12 +234,15 @@ def team_name() -> str:
def player_id() -> int:
"""Create and set Yahoo Fantasy Sports player ID for testing."""

# FOOTBALL
player_id = 30123 # NFL: Patrick Mahomes - 2020/2021/2023

# HOCKEY
# player_id = 4588 # NHL: Braden Holtby - 2012
# player_id = 8205 # NHL: Jeffrey Viel - 2021
# player_id = 3637 # NHL: Alex Ovechkin - 2021

# BASEBALL
# player_id = 9897 # MLB: Tim Anderson - 2021/2022

return player_id
Expand All @@ -229,6 +262,5 @@ def league_player_limit() -> int:
"""Set Yahoo Fantasy Sports league player retrieval limit for testing."""

league_player_limit = 101
# league_player_limit = 2610

return league_player_limit
4 changes: 2 additions & 2 deletions yfpy/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -948,7 +948,7 @@ def __init__(self, extracted_data):
Attributes:
cant_cut_list (int): Numeric boolean (0 or 1) representing if the league uses the Yahoo "can't cut list".
divisions (int): Numeric boolean (0 or 1) representing if the league has divisions.
divisions (list[Division]): A list of YFPY Division instances for leagues with divisions.
draft_pick_time (int): The number of seconds allowed to make each draft pick.
draft_time (int): A timestamp representing when the draft will start.
draft_together (int): Numeric boolean (0 or 1) representing if the league uses Yahoo Fantasy Draft Together
Expand Down Expand Up @@ -992,7 +992,7 @@ def __init__(self, extracted_data):
"""
YahooFantasyObject.__init__(self, extracted_data)
self.cant_cut_list: int = self._extracted_data.get("cant_cut_list", 0)
self.divisions: int = self._extracted_data.get("divisions", 0)
self.divisions: List[Division] = self._extracted_data.get("divisions", [])
self.draft_pick_time: int = self._extracted_data.get("draft_pick_time", None)
self.draft_time: int = self._extracted_data.get("draft_time", None)
self.draft_together: int = self._extracted_data.get("draft_together", 0)
Expand Down

0 comments on commit 8ef1212

Please sign in to comment.