Skip to content

Commit d3e3df9

Browse files
committed
Cleaning up MyPy errors
1 parent 1c943b2 commit d3e3df9

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

backend/tests/unit/onyx/utils/test_vespa_tasks.py

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from types import SimpleNamespace
2+
from typing import Any
23

34
from onyx.background.celery.tasks.vespa import tasks as vespa_tasks
45

@@ -29,7 +30,7 @@ def reset(self) -> None:
2930
self.__class__.reset_called = True
3031

3132

32-
def _setup_common_patches(monkeypatch, document_set):
33+
def _setup_common_patches(monkeypatch: Any, document_set: Any) -> dict[str, bool]:
3334
calls: dict[str, bool] = {"deleted": False, "synced": False}
3435

3536
monkeypatch.setattr(vespa_tasks, "RedisDocumentSet", _StubRedisDocumentSet)
@@ -40,12 +41,12 @@ def _setup_common_patches(monkeypatch, document_set):
4041
lambda db_session, document_set_id: document_set,
4142
)
4243

43-
def _delete(document_set_row, db_session) -> None:
44+
def _delete(document_set_row: Any, db_session: Any) -> None:
4445
calls["deleted"] = True
4546

4647
monkeypatch.setattr(vespa_tasks, "delete_document_set", _delete)
4748

48-
def _mark(document_set_id, db_session) -> None:
49+
def _mark(document_set_id: Any, db_session: Any) -> None:
4950
calls["synced"] = True
5051

5152
monkeypatch.setattr(vespa_tasks, "mark_document_set_as_synced", _mark)
@@ -59,7 +60,7 @@ def _mark(document_set_id, db_session) -> None:
5960
return calls
6061

6162

62-
def test_monitor_preserves_federated_only_document_set(monkeypatch):
63+
def test_monitor_preserves_federated_only_document_set(monkeypatch: Any) -> None:
6364
document_set = SimpleNamespace(
6465
connector_credential_pairs=[],
6566
federated_connectors=[object()],
@@ -70,15 +71,15 @@ def test_monitor_preserves_federated_only_document_set(monkeypatch):
7071
vespa_tasks.monitor_document_set_taskset(
7172
tenant_id="tenant",
7273
key_bytes=b"documentset_fence_1",
73-
r=SimpleNamespace(scard=lambda key: 0),
74-
db_session=SimpleNamespace(),
74+
r=SimpleNamespace(scard=lambda key: 0), # type: ignore[arg-type]
75+
db_session=SimpleNamespace(), # type: ignore[arg-type]
7576
)
7677

7778
assert calls["synced"] is True
7879
assert calls["deleted"] is False
7980

8081

81-
def test_monitor_deletes_document_set_with_no_connectors(monkeypatch):
82+
def test_monitor_deletes_document_set_with_no_connectors(monkeypatch: Any) -> None:
8283
document_set = SimpleNamespace(
8384
connector_credential_pairs=[],
8485
federated_connectors=[],
@@ -89,8 +90,8 @@ def test_monitor_deletes_document_set_with_no_connectors(monkeypatch):
8990
vespa_tasks.monitor_document_set_taskset(
9091
tenant_id="tenant",
9192
key_bytes=b"documentset_fence_2",
92-
r=SimpleNamespace(scard=lambda key: 0),
93-
db_session=SimpleNamespace(),
93+
r=SimpleNamespace(scard=lambda key: 0), # type: ignore[arg-type]
94+
db_session=SimpleNamespace(), # type: ignore[arg-type]
9495
)
9596

9697
assert calls["deleted"] is True

0 commit comments

Comments
 (0)