Django

Code

Ticket #6122 (closed: fixed)

Opened 7 months ago

Last modified 7 months ago

Update tests to check for new maxlength + max_length TypeError wording

Reported by: mcroydon Assigned to: nobody
Milestone: Component: Unit test system
Version: SVN Keywords:
Cc: Triage Stage: Unreviewed
Has patch: 1 Needs documentation:
Needs tests: Patch needs improvement:

Description

Changeset [6872] introduced new wording for the TypeError? raised when both maxlength and max_length are specified. This patch updates the tests to look for the new wording instead of the old. The test is doing the right thing just failing because of the difference in wording. Here's an example of the failing tests:

======================================================================
FAIL: Doctest: regressiontests.maxlength.tests
----------------------------------------------------------------------
Traceback (most recent call last):   
  File "/home/mcroydon/test/django/test/_doctest.py", line 2180, in runTest
    raise self.failureException(self.format_failure(new.getvalue()))
AssertionError: Failed doctest test for regressiontests.maxlength.tests
  File "/home/mcroydon/code/django-trunk/tests/regressiontests/maxlength/tests.py", line 2, in tests

----------------------------------------------------------------------
File "/home/mcroydon/code/django-trunk/tests/regressiontests/maxlength/tests.py", line 22, in regressiontests.maxlength.tests
Failed example:
    legacy_maxlength(10, 12)
Expected:
    Traceback (most recent call last):
    ...
    TypeError: field can not take both the max_length argument and the legacy maxlength argument.
Got:
    Traceback (most recent call last):
      File "/home/mcroydon/test/django/test/_doctest.py", line 1267, in __run
        compileflags, 1) in test.globs
      File "<doctest regressiontests.maxlength.tests[6]>", line 1, in ?
        legacy_maxlength(10, 12)
      File "/home/mcroydon/test/django/utils/maxlength.py", line 26, in legacy_maxlength
        raise TypeError("Field cannot take both the max_length argument and the legacy maxlength argument.")
    TypeError: Field cannot take both the max_length argument and the legacy maxlength argument. 

After applying the patch the tests pass.

Attachments

update_tests_for_maxlength_typerror.diff (1.1 kB) - added by mcroydon on 12/04/07 07:21:13.
Fixes tests that are throwing the correct TypeError? but looking for the wrong text

Change History

12/04/07 07:21:13 changed by mcroydon

  • attachment update_tests_for_maxlength_typerror.diff added.

Fixes tests that are throwing the correct TypeError? but looking for the wrong text

12/04/07 11:14:32 changed by jacob

  • status changed from new to closed.
  • resolution set to fixed.

(In [6885]) Fixed #6122: Fixed tests broken by [6872]. Thanks, Matt.


Add/Change #6122 (Update tests to check for new maxlength + max_length TypeError wording)




Change Properties
Action