Skip to content

Commit 309d332

Browse files
committed
fix(types): Add cast for HybridCloudForeignKey in test fixture
Add isinstance check and cast to narrow the generic type parameters for HybridCloudForeignKey fixture return type.
1 parent 2d28dad commit 309d332

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

tests/sentry/deletions/tasks/test_hybrid_cloud.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,11 @@ def reset_watermarks() -> None:
9292

9393
@pytest.fixture
9494
def saved_search_owner_id_field() -> HybridCloudForeignKey[int, int]:
95-
return SavedSearch._meta.get_field("owner_id")
95+
from typing import cast
96+
97+
field = SavedSearch._meta.get_field("owner_id")
98+
assert isinstance(field, HybridCloudForeignKey)
99+
return cast(HybridCloudForeignKey[int, int], field)
96100

97101

98102
@django_db_all

0 commit comments

Comments
 (0)