Opened 17 years ago

Closed 17 years ago

#6122 closed (fixed)

Update tests to check for new maxlength + max_length TypeError wording

Reported by: mcroydon Owned by: nobody
Component: Testing framework Version: dev
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

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 (1)

update_tests_for_maxlength_typerror.diff (1.1 KB ) - added by mcroydon 17 years ago.
Fixes tests that are throwing the correct TypeError but looking for the wrong text

Download all attachments as: .zip

Change History (2)

by mcroydon, 17 years ago

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

comment:1 by Jacob, 17 years ago

Resolution: fixed
Status: newclosed

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

Note: See TracTickets for help on using tickets.
Back to Top