#35723: Change django.forms.formsets.all_valid() to use generator instead of 
list
comprehension
-------------------------------------+-------------------------------------
     Reporter:  Prashant Rana        |                    Owner:  (none)
         Type:                       |                   Status:  closed
  Cleanup/optimization               |
    Component:  Forms                |                  Version:  dev
     Severity:  Normal               |               Resolution:  invalid
     Keywords:  formsets,            |             Triage Stage:
  validation                         |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  1                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

 * resolution:   => invalid
 * status:  new => closed
 * summary:
     formset all_valid use generator comprehension instead of list
     comprehension
     =>
     Change django.forms.formsets.all_valid() to use generator instead of
     list comprehension

Comment:

 That would make the behavior not match the docstring ("Validate every
 formset") and it causes a test failure:
 {{{
 ======================================================================
 FAIL: test_invalid
 (forms_tests.tests.test_formsets.AllValidTests.test_invalid)
 all_valid() validates all forms, even when some are invalid.
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File "/home/tim/code/django/tests/forms_tests/tests/test_formsets.py",
 line 1962, in test_invalid
     self.assertEqual(formset2._errors, expected_errors)
 AssertionError: None != [{'votes': ['This field is required.']}, {'votes':
 ['This field is required.']}]
 }}}
-- 
Ticket URL: <https://code.djangoproject.com/ticket/35723#comment:1>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070191a7dd1a07-5dafd57b-20a5-4889-891d-13a8cbffe422-000000%40eu-central-1.amazonses.com.

Reply via email to