Fixing/debugging code for tests.

Signed-off-by: Cliff Hill <xlorep@darkhelm.org>
This commit is contained in:
2021-10-04 10:26:26 -04:00
parent efa8a469db
commit 8ce13a8ccf
4 changed files with 36 additions and 36 deletions

View File

@@ -3,14 +3,14 @@ import dataclasses
import datetime
import typing
import marshmallow # type: ignore [import]
import pytest # type: ignore [import]
import marshmallow
import pytest
from playlist.data import base # type: ignore [import]
from playlist.data import base
@dataclasses.dataclass
class Dummy(base.BaseData["Dummy"]): # type: ignore [misc]
class Dummy(base.BaseData["Dummy"]):
"""Dummy class for tests."""
name: str
@@ -20,7 +20,7 @@ class Dummy(base.BaseData["Dummy"]): # type: ignore [misc]
modified: datetime.datetime
@pytest.fixture # type: ignore [misc]
@pytest.fixture
def dummyannotations() -> dict[str, typing.Any]:
"""Make a dummy annotation dict for testing."""
return {
@@ -32,13 +32,13 @@ def dummyannotations() -> dict[str, typing.Any]:
}
@pytest.fixture # type: ignore [misc]
@pytest.fixture
def modified_date() -> datetime.datetime:
"""Make a reusable datetime for testing."""
return datetime.datetime.now()
@pytest.fixture # type: ignore [misc]
@pytest.fixture
def dummydict(modified_date: datetime.datetime) -> dict[str, typing.Any]:
"""Make a dummy dictionary for testing."""
return {
@@ -50,7 +50,7 @@ def dummydict(modified_date: datetime.datetime) -> dict[str, typing.Any]:
}
@pytest.fixture # type: ignore [misc]
@pytest.fixture
def dummyobj(modified_date: datetime.datetime) -> Dummy:
"""Make a dummy object for testing."""
return Dummy(
@@ -76,7 +76,7 @@ def test_dict(dummyannotations: dict[str, typing.Any]) -> None:
assert result
def test_load(dummydict: dict[str, typing.Any], dummyobj: Dummy) -> None:
def test_load(dummydict: base.DataDict, dummyobj: Dummy) -> None:
"""Validate that <data class>.load() works."""
result = Dummy.load(dummydict)
assert result == dummyobj

View File

@@ -12,7 +12,7 @@ def example_settings() -> settings.Settings:
return settings.Settings(
creds=settings.CredentialSettings(
baseurl="http://nowhere.huh",
token="Fake Token", # noqa: S105
token="Fake Token", # noqa: S106
),
)