Code

Opened 6 years ago

Closed 6 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: master
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: yes Needs documentation:
Needs tests: Patch needs improvement:
Easy pickings: UI/UX:

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 6 years ago.
Fixes tests that are throwing the correct TypeError but looking for the wrong text

Download all attachments as: .zip

Change History (2)

Changed 6 years ago by mcroydon

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

comment:1 Changed 6 years ago by jacob

  • Resolution set to fixed
  • Status changed from new to closed

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

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.