mirror of
https://github.com/rennf93/roboco.git
synced 2026-08-03 07:23:24 +02:00
[fix] resolve 16 mypy errors across 9 test files (make quality gate)
type-clean the test files so make quality (mypy roboco/ tests/) is green:
- Any-typed locals for the two TypeError-asserting scoping tests (bypass
the required-arg check without getattr/ruff B009)
- Any-typed view for the shutdown-drain _drain_bg_tasks override (bypass
mypy method-assign without setattr/ruff B010)
- cast("uuid.UUID", ...) / cast("UUID", ...) for SQLAlchemy UUID[Any]
returns (TC006-quoted), config=None for AgentInstance stubs, None-narrowed
await_args, Iterator return on a yielding fixture, UUID annotation on the
_task helper. No type:ignore / noqa.
This commit is contained in:
@@ -1170,14 +1170,20 @@ async def _seed_messages_same_timestamp(
|
||||
timestamp so the equal-timestamp pagination skip is reproducible. Returns
|
||||
``(session_id, message_ids)``."""
|
||||
ch = await svc.create_channel(_channel_req(uuid4().hex[:6]))
|
||||
grp = await svc.create_group(GroupCreateRequest(name="g1", channel_id=ch.id))
|
||||
sess = await svc.create_session(SessionCreateRequest(group_id=grp.id))
|
||||
grp = await svc.create_group(
|
||||
GroupCreateRequest(name="g1", channel_id=cast("uuid.UUID", ch.id))
|
||||
)
|
||||
sess = await svc.create_session(
|
||||
SessionCreateRequest(group_id=cast("uuid.UUID", grp.id))
|
||||
)
|
||||
ids: list[UUID] = []
|
||||
for i in range(count):
|
||||
m = await svc.send_message(
|
||||
MessageCreateRequest(agent_id=aid, session_id=sess.id, content=f"m-{i}")
|
||||
MessageCreateRequest(
|
||||
agent_id=aid, session_id=cast("uuid.UUID", sess.id), content=f"m-{i}"
|
||||
)
|
||||
)
|
||||
ids.append(m.id)
|
||||
ids.append(cast("uuid.UUID", m.id))
|
||||
fixed = datetime.now(UTC)
|
||||
rows = (
|
||||
(
|
||||
@@ -1191,7 +1197,7 @@ async def _seed_messages_same_timestamp(
|
||||
for row in rows:
|
||||
row.timestamp = fixed
|
||||
await session.flush()
|
||||
return sess.id, ids
|
||||
return cast("uuid.UUID", sess.id), ids
|
||||
|
||||
|
||||
@pytest.mark.asyncio
|
||||
|
||||
Reference in New Issue
Block a user