diff options
| author | Mariusz Felisiak <felisiak.mariusz@gmail.com> | 2024-01-26 12:45:07 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-01-26 12:45:07 +0100 |
| commit | 305757aec19c9d5111e4d76095ae0acd66163e4b (patch) | |
| tree | 04aa017e66c06b3b19cb466ed4e1d73cd871523d /tests/contenttypes_tests | |
| parent | 3f6d939c62efd967f548c27a265748cc2cc47ca5 (diff) | |
Applied Black's 2024 stable style.
https://github.com/psf/black/releases/tag/24.1.0
Diffstat (limited to 'tests/contenttypes_tests')
| -rw-r--r-- | tests/contenttypes_tests/test_management.py | 14 | ||||
| -rw-r--r-- | tests/contenttypes_tests/test_models.py | 5 | ||||
| -rw-r--r-- | tests/contenttypes_tests/test_views.py | 12 |
3 files changed, 15 insertions, 16 deletions
diff --git a/tests/contenttypes_tests/test_management.py b/tests/contenttypes_tests/test_management.py index eb472d80ce..14ff4e5952 100644 --- a/tests/contenttypes_tests/test_management.py +++ b/tests/contenttypes_tests/test_management.py @@ -88,9 +88,10 @@ class RemoveStaleContentTypesTests(TestCase): def test_contenttypes_removed_in_installed_apps_without_models(self): ContentType.objects.create(app_label="empty_models", model="Fake 1") ContentType.objects.create(app_label="no_models", model="Fake 2") - with mock.patch( - "builtins.input", return_value="yes" - ), captured_stdout() as stdout: + with ( + mock.patch("builtins.input", return_value="yes"), + captured_stdout() as stdout, + ): call_command("remove_stale_contenttypes", verbosity=2) self.assertNotIn( "Deleting stale content type 'empty_models | Fake 1'", @@ -106,9 +107,10 @@ class RemoveStaleContentTypesTests(TestCase): def test_contenttypes_removed_for_apps_not_in_installed_apps(self): ContentType.objects.create(app_label="empty_models", model="Fake 1") ContentType.objects.create(app_label="no_models", model="Fake 2") - with mock.patch( - "builtins.input", return_value="yes" - ), captured_stdout() as stdout: + with ( + mock.patch("builtins.input", return_value="yes"), + captured_stdout() as stdout, + ): call_command( "remove_stale_contenttypes", include_stale_apps=True, verbosity=2 ) diff --git a/tests/contenttypes_tests/test_models.py b/tests/contenttypes_tests/test_models.py index 02036de83f..88f715ceff 100644 --- a/tests/contenttypes_tests/test_models.py +++ b/tests/contenttypes_tests/test_models.py @@ -323,8 +323,9 @@ class ContentTypesMultidbTests(TestCase): db_for_read(). """ ContentType.objects.clear_cache() - with self.assertNumQueries(0, using="default"), self.assertNumQueries( - 1, using="other" + with ( + self.assertNumQueries(0, using="default"), + self.assertNumQueries(1, using="other"), ): ContentType.objects.get_for_model(Author) diff --git a/tests/contenttypes_tests/test_views.py b/tests/contenttypes_tests/test_views.py index 4d85d15065..75f39a7bab 100644 --- a/tests/contenttypes_tests/test_views.py +++ b/tests/contenttypes_tests/test_views.py @@ -150,10 +150,8 @@ class ContentTypesViewsSiteRelTests(TestCase): """ The shortcut view works if a model's ForeignKey to site is None. """ - get_model.side_effect = ( - lambda *args, **kwargs: MockSite - if args[0] == "sites.Site" - else ModelWithNullFKToSite + get_model.side_effect = lambda *args, **kwargs: ( + MockSite if args[0] == "sites.Site" else ModelWithNullFKToSite ) obj = ModelWithNullFKToSite.objects.create(title="title") @@ -172,10 +170,8 @@ class ContentTypesViewsSiteRelTests(TestCase): site if it's attached to the object or to the domain of the first site found in the m2m relationship. """ - get_model.side_effect = ( - lambda *args, **kwargs: MockSite - if args[0] == "sites.Site" - else ModelWithM2MToSite + get_model.side_effect = lambda *args, **kwargs: ( + MockSite if args[0] == "sites.Site" else ModelWithM2MToSite ) # get_current_site() will lookup a Site object, so these must match the |
