mirror of
https://github.com/ChuckBuilds/LEDMatrix.git
synced 2026-04-10 13:02:59 +00:00
Fix test script to handle missing game data keys
- Added safe key access using .get() method with defaults - Added display of available keys in game data for debugging - Added sport field display to help identify data structure - This prevents KeyError when game data structure changes
This commit is contained in:
@@ -64,13 +64,15 @@ def test_dynamic_duration():
|
|||||||
if odds_ticker.games_data:
|
if odds_ticker.games_data:
|
||||||
print("\nSample game data:")
|
print("\nSample game data:")
|
||||||
for i, game in enumerate(odds_ticker.games_data[:3]): # Show first 3 games
|
for i, game in enumerate(odds_ticker.games_data[:3]): # Show first 3 games
|
||||||
print(f" Game {i+1}: {game['away_team']} @ {game['home_team']}")
|
print(f" Game {i+1}: {game.get('away_team', 'Unknown')} @ {game.get('home_team', 'Unknown')}")
|
||||||
print(f" Time: {game['start_time']}")
|
print(f" Time: {game.get('start_time', 'Unknown')}")
|
||||||
print(f" League: {game['league']}")
|
print(f" League: {game.get('league', 'Unknown')}")
|
||||||
|
print(f" Sport: {game.get('sport', 'Unknown')}")
|
||||||
if game.get('odds'):
|
if game.get('odds'):
|
||||||
print(f" Has odds: Yes")
|
print(f" Has odds: Yes")
|
||||||
else:
|
else:
|
||||||
print(f" Has odds: No")
|
print(f" Has odds: No")
|
||||||
|
print(f" Available keys: {list(game.keys())}")
|
||||||
print()
|
print()
|
||||||
|
|
||||||
# Check dynamic duration calculation
|
# Check dynamic duration calculation
|
||||||
|
|||||||
Reference in New Issue
Block a user