Bump nyt_games to 0.4.2 (#126834)
* Bump nyt_games to 0.4.1 * Bump nyt_games to 0.4.1 * Bump nyt_games to 0.4.2pull/126842/head
parent
1c13851858
commit
8d428acbbb
|
@ -22,7 +22,7 @@ class NYTGamesData:
|
|||
"""Class for NYT Games data."""
|
||||
|
||||
wordle: Wordle
|
||||
spelling_bee: SpellingBee
|
||||
spelling_bee: SpellingBee | None
|
||||
connections: Connections
|
||||
|
||||
|
||||
|
|
|
@ -6,5 +6,5 @@
|
|||
"documentation": "https://www.home-assistant.io/integrations/nyt_games",
|
||||
"integration_type": "service",
|
||||
"iot_class": "cloud_polling",
|
||||
"requirements": ["nyt_games==0.4.0"]
|
||||
"requirements": ["nyt_games==0.4.2"]
|
||||
}
|
||||
|
|
|
@ -156,10 +156,11 @@ async def async_setup_entry(
|
|||
entities: list[SensorEntity] = [
|
||||
NYTGamesWordleSensor(coordinator, description) for description in WORDLE_SENSORS
|
||||
]
|
||||
entities.extend(
|
||||
NYTGamesSpellingBeeSensor(coordinator, description)
|
||||
for description in SPELLING_BEE_SENSORS
|
||||
)
|
||||
if coordinator.data.spelling_bee is not None:
|
||||
entities.extend(
|
||||
NYTGamesSpellingBeeSensor(coordinator, description)
|
||||
for description in SPELLING_BEE_SENSORS
|
||||
)
|
||||
entities.extend(
|
||||
NYTGamesConnectionsSensor(coordinator, description)
|
||||
for description in CONNECTIONS_SENSORS
|
||||
|
@ -211,6 +212,7 @@ class NYTGamesSpellingBeeSensor(SpellingBeeEntity, SensorEntity):
|
|||
@property
|
||||
def native_value(self) -> StateType:
|
||||
"""Return the state of the sensor."""
|
||||
assert self.coordinator.data.spelling_bee is not None
|
||||
return self.entity_description.value_fn(self.coordinator.data.spelling_bee)
|
||||
|
||||
|
||||
|
|
|
@ -1484,7 +1484,7 @@ numato-gpio==0.13.0
|
|||
numpy==1.26.4
|
||||
|
||||
# homeassistant.components.nyt_games
|
||||
nyt_games==0.4.0
|
||||
nyt_games==0.4.2
|
||||
|
||||
# homeassistant.components.oasa_telematics
|
||||
oasatelematics==0.3
|
||||
|
|
|
@ -1232,7 +1232,7 @@ numato-gpio==0.13.0
|
|||
numpy==1.26.4
|
||||
|
||||
# homeassistant.components.nyt_games
|
||||
nyt_games==0.4.0
|
||||
nyt_games==0.4.2
|
||||
|
||||
# homeassistant.components.google
|
||||
oauth2client==4.1.3
|
||||
|
|
|
@ -0,0 +1,51 @@
|
|||
{
|
||||
"states": [],
|
||||
"user_id": 260705259,
|
||||
"player": {
|
||||
"user_id": 260705259,
|
||||
"last_updated": 1727358123,
|
||||
"stats": {
|
||||
"wordle": {
|
||||
"legacyStats": {
|
||||
"gamesPlayed": 1,
|
||||
"gamesWon": 1,
|
||||
"guesses": {
|
||||
"1": 0,
|
||||
"2": 0,
|
||||
"3": 0,
|
||||
"4": 0,
|
||||
"5": 1,
|
||||
"6": 0,
|
||||
"fail": 0
|
||||
},
|
||||
"currentStreak": 0,
|
||||
"maxStreak": 1,
|
||||
"lastWonDayOffset": 1118,
|
||||
"hasPlayed": true,
|
||||
"autoOptInTimestamp": 1727357874700,
|
||||
"hasMadeStatsChoice": false,
|
||||
"timestamp": 1727358123
|
||||
},
|
||||
"calculatedStats": {
|
||||
"gamesPlayed": 0,
|
||||
"gamesWon": 0,
|
||||
"guesses": {
|
||||
"1": 0,
|
||||
"2": 0,
|
||||
"3": 0,
|
||||
"4": 0,
|
||||
"5": 0,
|
||||
"6": 0,
|
||||
"fail": 0
|
||||
},
|
||||
"currentStreak": 0,
|
||||
"maxStreak": 1,
|
||||
"lastWonPrintDate": "",
|
||||
"lastCompletedPrintDate": "",
|
||||
"hasPlayed": false,
|
||||
"generation": 1
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -547,7 +547,7 @@
|
|||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '33',
|
||||
'state': '70',
|
||||
})
|
||||
# ---
|
||||
# name: test_all_entities[sensor.wordle_won-entry]
|
||||
|
@ -597,6 +597,6 @@
|
|||
'last_changed': <ANY>,
|
||||
'last_reported': <ANY>,
|
||||
'last_updated': <ANY>,
|
||||
'state': '26',
|
||||
'state': '51',
|
||||
})
|
||||
# ---
|
||||
|
|
|
@ -4,17 +4,23 @@ from datetime import timedelta
|
|||
from unittest.mock import AsyncMock
|
||||
|
||||
from freezegun.api import FrozenDateTimeFactory
|
||||
from nyt_games import NYTGamesError
|
||||
from nyt_games import NYTGamesError, WordleStats
|
||||
import pytest
|
||||
from syrupy import SnapshotAssertion
|
||||
|
||||
from homeassistant.components.nyt_games.const import DOMAIN
|
||||
from homeassistant.const import STATE_UNAVAILABLE
|
||||
from homeassistant.core import HomeAssistant
|
||||
from homeassistant.helpers import entity_registry as er
|
||||
|
||||
from . import setup_integration
|
||||
|
||||
from tests.common import MockConfigEntry, async_fire_time_changed, snapshot_platform
|
||||
from tests.common import (
|
||||
MockConfigEntry,
|
||||
async_fire_time_changed,
|
||||
load_fixture,
|
||||
snapshot_platform,
|
||||
)
|
||||
|
||||
|
||||
@pytest.mark.usefixtures("entity_registry_enabled_by_default")
|
||||
|
@ -55,3 +61,17 @@ async def test_updating_exception(
|
|||
await hass.async_block_till_done()
|
||||
|
||||
assert hass.states.get("sensor.wordle_played").state != STATE_UNAVAILABLE
|
||||
|
||||
|
||||
async def test_new_account(
|
||||
hass: HomeAssistant,
|
||||
mock_nyt_games_client: AsyncMock,
|
||||
mock_config_entry: MockConfigEntry,
|
||||
) -> None:
|
||||
"""Test handling an exception during update."""
|
||||
mock_nyt_games_client.get_latest_stats.return_value = WordleStats.from_json(
|
||||
load_fixture("new_account.json", DOMAIN)
|
||||
).player.stats
|
||||
await setup_integration(hass, mock_config_entry)
|
||||
|
||||
assert hass.states.get("sensor.spelling_bee_played") is None
|
||||
|
|
Loading…
Reference in New Issue