#11603: Add an assertFormSetError function to django.test.TestCase
-------------------------------------+-------------------------------------
               Reporter:             |          Owner:  martin_speleo
  martin_speleo                      |         Status:  new
                   Type:  New        |      Component:  Testing framework
  feature                            |       Severity:  Normal
              Milestone:  1.4        |       Keywords:  formset
                Version:  SVN        |      Has patch:  1
             Resolution:             |    Needs tests:  0
           Triage Stage:  Accepted   |  Easy pickings:  0
    Needs documentation:  0          |
Patch needs improvement:  1          |
                  UI/UX:  0          |
-------------------------------------+-------------------------------------

Comment (by russellm):

 As requested in a private chat, here are the errors I see running against
 r16707, Python 2.6.1, under OSX Snow Leopard.
 {{{

 django)kronkite:tests rkm$ ./runtests.py --settings=sqlite test_client
 test_client_regress
 Creating test database for alias 'default'...
 Creating test database for alias 'other'...
 
.................................................FF...F..FF..................................................................
 ======================================================================
 FAIL: test_no_nonfield_error
 (regressiontests.test_client_regress.models.AssertFormsetErrorTests)
 An assertion is raised if the formsets non-field errors doesn't contain
 any errors.
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 
"/Users/rkm/projects/django/hg/tests/regressiontests/test_client_regress/models.py",
 line 606, in test_no_nonfield_error
     prefix + "The formset 'my_formset', form 1 in "
 AssertionError: "True is not False : The formset 'my_formset', form 1 in
 context 0 does not contain any non-field errors." != "The formset
 'my_formset', form 1 in context 0 does not contain any non-field errors."

 ======================================================================
 FAIL: test_no_nonform_error
 (regressiontests.test_client_regress.models.AssertFormsetErrorTests)
 An assertion is raised if the formsets non-form errors doesn't contain any
 errors.
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 
"/Users/rkm/projects/django/hg/tests/regressiontests/test_client_regress/models.py",
 line 647, in test_no_nonform_error
     "The formset 'my_formset' in context 0 "
 AssertionError: "True is not False : The formset 'my_formset' in context 0
 does not contain any non-form errors." != "The formset 'my_formset' in
 context 0 does not contain any non-form errors."

 ======================================================================
 FAIL: test_unknown_error
 (regressiontests.test_client_regress.models.AssertFormsetErrorTests)
 An assertion is raised if the field doesn't contain the specified error
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 
"/Users/rkm/projects/django/hg/tests/regressiontests/test_client_regress/models.py",
 line 579, in test_unknown_error
     prefix + "The field 'email' "
 AssertionError: "False is not True : The field 'email' on formset
 'my_formset', form 0 in context 0 does not contain the error 'Some error.'
 (actual errors: [u'Enter a valid e-mail address.'])" != "The field 'email'
 on formset 'my_formset', form 0 in context 0 does not contain the error
 'Some error.' (actual errors: [u'Enter a valid e-mail address.'])"

 ======================================================================
 FAIL: test_unknown_nonfield_error
 (regressiontests.test_client_regress.models.AssertFormsetErrorTests)
 An assertion is raised if the formsets non-field errors doesn't contain
 the provided error.
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 
"/Users/rkm/projects/django/hg/tests/regressiontests/test_client_regress/models.py",
 line 621, in test_unknown_nonfield_error
     prefix + "The formset 'my_formset', form 0 in "
 AssertionError: "False is not True : The formset 'my_formset', form 0 in
 context 0 does not contain the non-field error 'Some error.' (actual
 errors: [u'Non-field error.'])" != "The formset 'my_formset', form 0 in
 context 0 does not contain the non-field error 'Some error.' (actual
 errors: [u'Non-field error.'])"

 ======================================================================
 FAIL: test_unknown_nonform_error
 (regressiontests.test_client_regress.models.AssertFormsetErrorTests)
 An assertion is raised if the formsets non-form errors doesn't contain the
 provided error.
 ----------------------------------------------------------------------
 Traceback (most recent call last):
   File
 
"/Users/rkm/projects/django/hg/tests/regressiontests/test_client_regress/models.py",
 line 661, in test_unknown_nonform_error
     "The formset 'my_formset' in context 0 does not "
 AssertionError: "False is not True : The formset 'my_formset' in context 0
 does not contain the non-form error 'Some error.' (actual errors: [u'Forms
 in a set must have distinct E-mail addresses.'])" != "The formset
 'my_formset' in context 0 does not contain the non-form error 'Some
 error.' (actual errors: [u'Forms in a set must have distinct E-mail
 addresses.'])"

 ----------------------------------------------------------------------
 Ran 125 tests in 3.638s

 FAILED (failures=5)
 }}}

-- 
Ticket URL: <https://code.djangoproject.com/ticket/11603#comment:12>
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 post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.

Reply via email to