Skip to content

Commit 93a9522

Browse files
committed
Improve doc for django_assert_num_queries/django_assert_max_num_queries
1 parent d23cf6e commit 93a9522

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

docs/helpers.rst

+15-15
Original file line numberDiff line numberDiff line change
@@ -278,24 +278,23 @@ Example
278278
assert settings.USE_TZ
279279

280280

281+
.. fixture:: django_assert_num_queries
282+
281283
``django_assert_num_queries``
282284
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
283285

284-
.. fixture:: django_assert_num_queries
286+
.. py:function:: django_assert_num_queries(connection=None, info=None)
287+
288+
:param connection: optional non-default DB connection
289+
:param str info: optional info message to display on failure
285290

286291
This fixture allows to check for an expected number of DB queries.
287292

288-
It wraps `django.test.utils.CaptureQueriesContext`. A non-default DB
289-
connection can be passed in using the `connection` keyword argument, an
290-
additional info message which is displayed on fail can be passed in using
291-
the `info` keyword argument, and it will yield the wrapped
293+
It wraps `django.test.utils.CaptureQueriesContext` and yields the wrapped
292294
CaptureQueriesContext instance.
293295

294296

295-
Example
296-
"""""""
297-
298-
::
297+
Example usage::
299298

300299
def test_queries(django_assert_num_queries):
301300
with django_assert_num_queries(3) as captured:
@@ -306,20 +305,21 @@ Example
306305
assert 'foo' in captured.captured_queries[0]['sql']
307306

308307

308+
.. fixture:: django_assert_max_num_queries
309+
309310
``django_assert_max_num_queries``
310311
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
311312

312-
.. fixture:: django_assert_max_num_queries
313+
.. py:function:: django_assert_num_queries(connection=None, info=None)
314+
315+
:param connection: optional non-default DB connection
316+
:param str info: optional info message to display on failure
313317

314318
This fixture allows to check for an expected maximum number of DB queries.
315319

316320
It is a specialized version of :fixture:`django_assert_num_queries`.
317321

318-
319-
Example
320-
"""""""
321-
322-
::
322+
Example usage::
323323

324324
def test_max_queries(django_assert_max_num_queries):
325325
with django_assert_max_num_queries(3):

0 commit comments

Comments
 (0)