Skip to content

Commit 8ef1212

Browse files
committed
add values to conftest and fix divisions in league settings
1 parent 3df4b40 commit 8ef1212

File tree

2 files changed

+41
-9
lines changed

2 files changed

+41
-9
lines changed

test/integration/conftest.py

Lines changed: 39 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,12 @@ def season() -> int:
7373
"""Set Yahoo Fantasy Sports season for testing."""
7474

7575
# season = 2012
76+
# season = 2013
7677
# season = 2014
7778
# season = 2015
79+
# season = 2016
80+
# season = 2017
81+
# season = 2018
7882
# season = 2019
7983
# season = 2020
8084
# season = 2021
@@ -97,10 +101,11 @@ def chosen_week() -> int:
97101
def chosen_date() -> str:
98102
"""Set Yahoo Fantasy Sports chosen date for testing."""
99103

100-
chosen_date = "2013-04-15" # NHL - 2013 (for 2012)
101-
# chosen_date = "2013-04-16" # NHL - 2013
102-
# chosen_date = "2021-10-25" # NHL - 2021
104+
# HOCKEY
105+
# chosen_date = "2013-04-15" # NHL - 2013 (for 2012 season)
106+
chosen_date = "2021-10-25" # NHL - 2021
103107

108+
# BASEBALL
104109
# chosen_date = "2021-04-01" # MLB - 2021
105110
# chosen_date = "2022-04-10" # MLB - 2022
106111

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

114-
# league_id = "907359" # NFL - 2015 (testing for league with divisions)
119+
# FOOTBALL
120+
# league_id = "907359" # NFL - 2015 (divisions)
115121
# league_id = "79230" # NFL - 2019
116122
# league_id = "655434" # NFL - 2020
117123
# league_id = "413954" # NFL - 2021
124+
# league_id = "791337" # NFL - 2022 (divisions)
118125
league_id = "321958" # NFL - 2023
119126

127+
# HOCKEY
120128
# league_id = "69624" # NHL - 2012
121129
# league_id = "101592" # NHL - 2021
122130

131+
# BASEBALL
123132
# league_id = "40134" # MLB - 2021
124133

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

141+
# FOOTBALL
132142
# game_id = 331 # NFL - 2014
133-
# game_id = 348 # NFL - 2015 (testing for league with divisions)
143+
# game_id = 348 # NFL - 2015 (divisions)
144+
# game_id = 359 # NFL - 2016
145+
# game_id = 371 # NFL - 2017
146+
# game_id = 380 # NFL - 2018
134147
# game_id = 390 # NFL - 2019
135148
# game_id = 399 # NFL - 2020
136149
# game_id = 406 # NFL - 2021
150+
# game_id = 414 # NFL - 2022 (divisions)
137151
game_id = 423 # NFL - 2023
138152

153+
# HOCKEY
139154
# game_id = 303 # NHL - 2012
140155
# game_id = 411 # NHL - 2021
141156

157+
# BASEBALL
142158
# game_id = 404 # MLB - 2021
143159
# game_id = 412 # MLB - 2022
144160

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

168+
# FOOTBALL
152169
# game_key = "331" # NFL - 2014
153-
# game_key = "348" # NFL - 2015 (testing for league with divisions)
170+
# game_key = "348" # NFL - 2015 (divisions)
171+
# game_key = "359" # NFL - 2016
172+
# game_key = "371" # NFL - 2017
173+
# game_key = "380" # NFL - 2018
154174
# game_key = "390" # NFL - 2019
155175
# game_key = "399" # NFL - 2020
156176
# game_key = "406" # NFL - 2021
177+
# game_key = "414" # NFL - 2022 (divisions)
157178
game_key = "423" # NFL - 2023
158179

180+
# HOCKEY
159181
# game_key = "303" # NHL - 2012
160182
# game_key = "411" # NHL - 2021
161183

184+
# BASEBALL
162185
# game_key = "404" # MLB - 2021
163186
# game_key = "412" # MLB - 2022
164187

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

195+
# FOOTBALL
172196
game_code = "nfl" # NFL
173197

198+
# HOCKEY
174199
# game_code = "nhl" # NHL
175200

201+
# BASEBALL
176202
# game_code = "mlb" # MLB
177203

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

211+
# FOOTBALL
185212
team_id = 1 # NFL
186213

214+
# HOCKEY
187215
# team_id = 2 # NHL (2012)
188216

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

224+
# FOOTBALL
196225
team_name = "Legion" # NFL
197226

227+
# HOCKEY
198228
# team_name = "The Bateleurs" # NHL (2012)
199229

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

237+
# FOOTBALL
207238
player_id = 30123 # NFL: Patrick Mahomes - 2020/2021/2023
208239

240+
# HOCKEY
209241
# player_id = 4588 # NHL: Braden Holtby - 2012
210242
# player_id = 8205 # NHL: Jeffrey Viel - 2021
211243
# player_id = 3637 # NHL: Alex Ovechkin - 2021
212244

245+
# BASEBALL
213246
# player_id = 9897 # MLB: Tim Anderson - 2021/2022
214247

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

231264
league_player_limit = 101
232-
# league_player_limit = 2610
233265

234266
return league_player_limit

yfpy/models.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -948,7 +948,7 @@ def __init__(self, extracted_data):
948948
949949
Attributes:
950950
cant_cut_list (int): Numeric boolean (0 or 1) representing if the league uses the Yahoo "can't cut list".
951-
divisions (int): Numeric boolean (0 or 1) representing if the league has divisions.
951+
divisions (list[Division]): A list of YFPY Division instances for leagues with divisions.
952952
draft_pick_time (int): The number of seconds allowed to make each draft pick.
953953
draft_time (int): A timestamp representing when the draft will start.
954954
draft_together (int): Numeric boolean (0 or 1) representing if the league uses Yahoo Fantasy Draft Together
@@ -992,7 +992,7 @@ def __init__(self, extracted_data):
992992
"""
993993
YahooFantasyObject.__init__(self, extracted_data)
994994
self.cant_cut_list: int = self._extracted_data.get("cant_cut_list", 0)
995-
self.divisions: int = self._extracted_data.get("divisions", 0)
995+
self.divisions: List[Division] = self._extracted_data.get("divisions", [])
996996
self.draft_pick_time: int = self._extracted_data.get("draft_pick_time", None)
997997
self.draft_time: int = self._extracted_data.get("draft_time", None)
998998
self.draft_together: int = self._extracted_data.get("draft_together", 0)

0 commit comments

Comments
 (0)