1
0
mirror of https://github.com/django/django.git synced 2025-10-23 21:59:11 +00:00

Fixed #34517 -- Avoided connection post_init signal to ImageField without width/height fields.

This commit is contained in:
Orhan Hirsch
2023-04-26 09:22:43 +02:00
committed by Mariusz Felisiak
parent 3b62d8c83e
commit ea53e7c09f
3 changed files with 15 additions and 5 deletions

View File

@@ -5,6 +5,7 @@ from unittest import skipIf
from django.core.exceptions import ImproperlyConfigured
from django.core.files import File
from django.core.files.images import ImageFile
from django.db.models import signals
from django.test import TestCase
from django.test.testcases import SerializeMixin
@@ -328,6 +329,13 @@ class ImageFieldNoDimensionsTests(ImageFieldTwoDimensionsTests):
PersonModel = Person
def test_post_init_not_connected(self):
person_model_id = id(self.PersonModel)
self.assertNotIn(
person_model_id,
[sender_id for (_, sender_id), *_ in signals.post_init.receivers],
)
@skipIf(Image is None, "Pillow is required to test ImageField")
class ImageFieldOneDimensionTests(ImageFieldTwoDimensionsTests):