fix(tests): satisfy basedpyright in test_representation_manager
The save-representation tests added in #615 were structurally correct but failed strict typing in two places. Static Analysis has been red on main since the merge. - `mock_save.await_args` is `_Call | None`; assert it's not None before reading `.kwargs` / `.args` so basedpyright can narrow the type - `SimpleNamespace(...)` passed as `message_level_configuration` is an intentional duck-typed mock (only `.dream.enabled` is read by `save_representation`), so opt out at the call site with `# pyright: ignore[reportArgumentType]` rather than constructing a full `ResolvedConfiguration` (matches the existing `reportPrivateUsage` ignore pattern in this file) No runtime behavior changes; `uv run basedpyright` is now clean project-wide. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
a70eb7825e
commit
f52115a22f
|
|
@ -24,6 +24,7 @@ async def _fake_tracked_db(_name: str):
|
|||
|
||||
def _saved_observations(mock_save: AsyncMock):
|
||||
call = mock_save.await_args
|
||||
assert call is not None, "mock was not awaited"
|
||||
if "all_observations" in call.kwargs:
|
||||
return call.kwargs["all_observations"]
|
||||
if len(call.args) > 1:
|
||||
|
|
@ -162,7 +163,9 @@ class TestRepresentationManagerSoftDelete:
|
|||
|
||||
class TestRepresentationManagerSave:
|
||||
@pytest.mark.asyncio
|
||||
async def test_save_representation_filters_blank_observations_before_embedding(self):
|
||||
async def test_save_representation_filters_blank_observations_before_embedding(
|
||||
self,
|
||||
):
|
||||
manager = RepresentationManager(
|
||||
"workspace",
|
||||
observer="observer",
|
||||
|
|
@ -202,7 +205,7 @@ class TestRepresentationManagerSave:
|
|||
message_ids=[1],
|
||||
session_name="session",
|
||||
message_created_at=datetime.now(timezone.utc),
|
||||
message_level_configuration=SimpleNamespace(
|
||||
message_level_configuration=SimpleNamespace( # pyright: ignore[reportArgumentType]
|
||||
dream=SimpleNamespace(enabled=False)
|
||||
),
|
||||
)
|
||||
|
|
@ -258,7 +261,7 @@ class TestRepresentationManagerSave:
|
|||
message_ids=[1],
|
||||
session_name="session",
|
||||
message_created_at=datetime.now(timezone.utc),
|
||||
message_level_configuration=SimpleNamespace(
|
||||
message_level_configuration=SimpleNamespace( # pyright: ignore[reportArgumentType]
|
||||
dream=SimpleNamespace(enabled=False)
|
||||
),
|
||||
)
|
||||
|
|
@ -311,7 +314,7 @@ class TestRepresentationManagerSave:
|
|||
message_ids=[1],
|
||||
session_name="session",
|
||||
message_created_at=datetime.now(timezone.utc),
|
||||
message_level_configuration=SimpleNamespace(
|
||||
message_level_configuration=SimpleNamespace( # pyright: ignore[reportArgumentType]
|
||||
dream=SimpleNamespace(enabled=False)
|
||||
),
|
||||
)
|
||||
|
|
|
|||
Loading…
Reference in New Issue