mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
[5.0.x] Applied Black's 2024 stable style.
https://github.com/psf/black/releases/tag/24.1.0
Backport of 305757aec1 from main
This commit is contained in:
@@ -1352,8 +1352,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
|
||||
@@ -1954,22 +1953,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::
|
||||
@@ -1977,8 +1972,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'``.
|
||||
@@ -2078,8 +2072,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:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user