Skip to content

Commit 8118866

Browse files
committed
Finish hints for status
1 parent 28aaa3c commit 8118866

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/django_mysql/status.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ def get_many(self, names: Iterable[str]) -> dict[str, int | float | bool | str]:
5757
]
5858
)
5959

60-
cursor.execute(query, names)
60+
cursor.execute(query, tuple(names))
6161

6262
return {name: self._cast(value) for name, value in cursor.fetchall()}
6363

tests/testapp/test_status.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ class GlobalStatusTests(TestCase):
4040

4141
def test_get(self):
4242
running = global_status.get("Threads_running")
43+
assert isinstance(running, int)
4344
assert running >= 1 and isinstance(running, int)
4445

4546
def test_get_bad_name(self):
@@ -130,14 +131,17 @@ class SessionStatusTests(TestCase):
130131

131132
def test_get_bytes_received(self):
132133
bytes_received = session_status.get("Bytes_received")
133-
assert bytes_received >= 0 and isinstance(bytes_received, int)
134+
assert isinstance(bytes_received, int)
135+
assert bytes_received >= 0
134136

135137
bytes_received_2 = session_status.get("Bytes_received")
138+
assert isinstance(bytes_received_2, int)
136139
assert bytes_received_2 >= bytes_received
137140

138141
def test_get_last_query_cost(self):
139142
cost = session_status.get("Last_query_cost")
140-
assert cost >= 0.0 and isinstance(cost, float)
143+
assert isinstance(cost, float)
144+
assert cost >= 0.0
141145

142146
def test_get_bad_name(self):
143147
with pytest.raises(ValueError) as excinfo:

0 commit comments

Comments
 (0)