Skip to content

Commit ad036ad

Browse files
committed
Type test util fetchall_dicts()
1 parent bc408b5 commit ad036ad

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

tests/testapp/utils.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
from __future__ import annotations
22

33
from contextlib import contextmanager
4+
from typing import Any
45

56
import pytest
67
from django.db import DEFAULT_DB_ALIAS, connection, connections
8+
from django.db.backends.utils import CursorWrapper
79
from django.test.utils import CaptureQueriesContext
810

911

@@ -72,6 +74,6 @@ def used_indexes(query, using=DEFAULT_DB_ALIAS):
7274
return {row["key"] for row in fetchall_dicts(cursor) if row["key"] is not None}
7375

7476

75-
def fetchall_dicts(cursor):
77+
def fetchall_dicts(cursor: CursorWrapper) -> list[dict[str, Any]]:
7678
columns = [x[0] for x in cursor.description]
7779
return [dict(zip(columns, row)) for row in cursor.fetchall()]

0 commit comments

Comments
 (0)