mirror of
https://github.com/django/django.git
synced 2025-09-26 20:19:16 +00:00
Eliminated the need to modify a model forms test when new test files are added.
This commit is contained in:
parent
5cc28dc752
commit
3fb718f17d
2 changed files with 3 additions and 7 deletions
|
@ -2328,18 +2328,14 @@ class FileAndImageFieldTests(TestCase):
|
|||
p.image.delete(save=False)
|
||||
|
||||
def test_file_path_field_blank(self):
|
||||
"""
|
||||
Regression test for #8842: FilePathField(blank=True)
|
||||
"""
|
||||
"""FilePathField(blank=True) includes the empty option."""
|
||||
class FPForm(forms.ModelForm):
|
||||
class Meta:
|
||||
model = FilePathModel
|
||||
fields = '__all__'
|
||||
|
||||
form = FPForm()
|
||||
names = [p[1] for p in form['path'].field.choices]
|
||||
names.sort()
|
||||
self.assertEqual(names, ['---------', '__init__.py', 'models.py', 'test_uuid.py', 'tests.py'])
|
||||
self.assertEqual([name for _, name in form['path'].field.choices], ['---------', 'models.py'])
|
||||
|
||||
@skipUnless(test_images, "Pillow not installed")
|
||||
def test_image_field(self):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue