Tests for forms aren't working as expected. #33495
Labels
Content:Learn:Django
Learning area Django docs
needs triage
Triage needed by staff and/or partners. Automatically applied when an issue is opened.
MDN URL
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Testing
What specific section or headline is this issue about?
https://developer.mozilla.org/en-US/docs/Learn/Server-side/Django/Testing#forms
What information was incorrect, unhelpful, or incomplete?
The last two tests which are testing forms are not passing.
def test_renew_form_date_today(self):
date = datetime.date.today()
form = RenewBookForm(data={'renewal_date': date})
self.assertTrue(form.is_valid())
def test_renew_form_date_max(self):
date = timezone.localtime() + datetime.timedelta(weeks=4)
form = RenewBookForm(data={'renewal_date': date})
self.assertTrue(form.is_valid())
These two are failing:
FAIL: test_renew_form_date_max (catalog.tests.test_forms.RenewBookFormTest)
Traceback (most recent call last):
File "/home/zmeu/code/Mozilla_Django_Tutorial/locallibrary/catalog/tests/test_forms.py", line 33, in test_renew_form_date_max
self.assertTrue(form.is_valid())
AssertionError: False is not true
======================================================================
FAIL: test_renew_form_date_today (catalog.tests.test_forms.RenewBookFormTest)
Traceback (most recent call last):
File "/home/zmeu/code/Mozilla_Django_Tutorial/locallibrary/catalog/tests/test_forms.py", line 28, in test_renew_form_date_today
self.assertTrue(form.is_valid())
AssertionError: False is not true
What did you expect to see?
I am following every instruction in the tutorial very carefully. I completed all challenges. I don't know what is wrong.
Do you have any supporting links, references, or citations?
No response
Do you have anything more you want to share?
No response
MDN metadata
Page report details
en-us/learn/server-side/django/testing
The text was updated successfully, but these errors were encountered: