Fix dangerous-default-value warnings in lastfm tests (#119601)
This commit is contained in:
parent
315e5f1d95
commit
27c08bcb5e
1 changed files with 7 additions and 6 deletions
|
@ -6,6 +6,7 @@ from pylast import PyLastError, Track
|
||||||
|
|
||||||
from homeassistant.components.lastfm.const import CONF_MAIN_USER, CONF_USERS
|
from homeassistant.components.lastfm.const import CONF_MAIN_USER, CONF_USERS
|
||||||
from homeassistant.const import CONF_API_KEY
|
from homeassistant.const import CONF_API_KEY
|
||||||
|
from homeassistant.helpers.typing import UNDEFINED, UndefinedType
|
||||||
|
|
||||||
API_KEY = "asdasdasdasdasd"
|
API_KEY = "asdasdasdasdasd"
|
||||||
USERNAME_1 = "testaccount1"
|
USERNAME_1 = "testaccount1"
|
||||||
|
@ -52,16 +53,16 @@ class MockUser:
|
||||||
username: str = USERNAME_1,
|
username: str = USERNAME_1,
|
||||||
now_playing_result: Track | None = None,
|
now_playing_result: Track | None = None,
|
||||||
thrown_error: Exception | None = None,
|
thrown_error: Exception | None = None,
|
||||||
friends: list = [],
|
friends: list | UndefinedType = UNDEFINED,
|
||||||
recent_tracks: list[Track] = [],
|
recent_tracks: list[Track] | UndefinedType = UNDEFINED,
|
||||||
top_tracks: list[Track] = [],
|
top_tracks: list[Track] | UndefinedType = UNDEFINED,
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Initialize the mock."""
|
"""Initialize the mock."""
|
||||||
self._now_playing_result = now_playing_result
|
self._now_playing_result = now_playing_result
|
||||||
self._thrown_error = thrown_error
|
self._thrown_error = thrown_error
|
||||||
self._friends = friends
|
self._friends = [] if friends is UNDEFINED else friends
|
||||||
self._recent_tracks = recent_tracks
|
self._recent_tracks = [] if recent_tracks is UNDEFINED else recent_tracks
|
||||||
self._top_tracks = top_tracks
|
self._top_tracks = [] if top_tracks is UNDEFINED else top_tracks
|
||||||
self.name = username
|
self.name = username
|
||||||
|
|
||||||
def get_name(self, capitalized: bool) -> str:
|
def get_name(self, capitalized: bool) -> str:
|
||||||
|
|
Loading…
Add table
Reference in a new issue