summaryrefslogtreecommitdiff
path: root/docs/topics/testing
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2024-01-26 12:45:07 +0100
committerGitHub <noreply@github.com>2024-01-26 12:45:07 +0100
commit305757aec19c9d5111e4d76095ae0acd66163e4b (patch)
tree04aa017e66c06b3b19cb466ed4e1d73cd871523d /docs/topics/testing
parent3f6d939c62efd967f548c27a265748cc2cc47ca5 (diff)
Applied Black's 2024 stable style.
https://github.com/psf/black/releases/tag/24.1.0
Diffstat (limited to 'docs/topics/testing')
-rw-r--r--docs/topics/testing/tools.txt21
1 files changed, 7 insertions, 14 deletions
diff --git a/docs/topics/testing/tools.txt b/docs/topics/testing/tools.txt
index cd05db2cf8..14a58c4c00 100644
--- a/docs/topics/testing/tools.txt
+++ b/docs/topics/testing/tools.txt
@@ -1361,8 +1361,7 @@ For example::
class OtherDBTests(TestCase):
databases = {"other"}
- def test_other_db_query(self):
- ...
+ def test_other_db_query(self): ...
This test will only allow queries against the ``other`` database. Just like for
:attr:`SimpleTestCase.databases` and :attr:`TransactionTestCase.databases`, the
@@ -1981,22 +1980,18 @@ you might label fast or slow tests::
class SampleTestCase(TestCase):
@tag("fast")
- def test_fast(self):
- ...
+ def test_fast(self): ...
@tag("slow")
- def test_slow(self):
- ...
+ def test_slow(self): ...
@tag("slow", "core")
- def test_slow_but_core(self):
- ...
+ def test_slow_but_core(self): ...
You can also tag a test case class::
@tag("slow", "core")
- class SampleTestCase(TestCase):
- ...
+ class SampleTestCase(TestCase): ...
Subclasses inherit tags from superclasses, and methods inherit tags from their
class. Given::
@@ -2004,8 +1999,7 @@ class. Given::
@tag("foo")
class SampleTestCaseChild(SampleTestCase):
@tag("bar")
- def test(self):
- ...
+ def test(self): ...
``SampleTestCaseChild.test`` will be labeled with ``'slow'``, ``'core'``,
``'bar'``, and ``'foo'``.
@@ -2105,8 +2099,7 @@ creates.
class MyTests(TestCase):
@mock.patch(...)
@async_to_sync
- async def test_my_thing(self):
- ...
+ async def test_my_thing(self): ...
.. _topics-testing-email: