[Django] #33315: A little question about writing your first Django application, Part 5

6 views
Skip to first unread message

Django

unread,
Nov 24, 2021, 3:52:31 AM11/24/21
to django-...@googlegroups.com
#33315: A little question about writing your first Django application, Part 5
-----------------------------------------+------------------------
Reporter: Rice-777 | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 3.2
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
-----------------------------------------+------------------------
In "Testing our new view", I ran the code copied from the web page, and
the running results did not match the expectations. The running results
are as follows:

FAILED (failures=3)

Every errot is like this: AssertionError: Lists differ: ['<Question: Past
question.>'] != [<Question: Past question.>]

So, I checked the source code of "assertQuerysetEqual()" and found the
line "items = map(transform, qs)"

cause each element in the list has more quotation marks

and then, I changed the
"assertQuerysetEqual(response.context['latest_question_list'],
[question],)" to
"assertEqual(list(response.context['latest_question_list']), [question])"

Run again, the code works normally this time, The results are as follows:

Creating test database for alias 'default'...
System check identified no issues (0 silenced).
........
----------------------------------------------------------------------
Ran 8 tests in 0.065s

OK
Destroying test database for alias 'default'...

In addition: this code does not show the running results on the website

--
Ticket URL: <https://code.djangoproject.com/ticket/33315>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Nov 24, 2021, 3:59:56 AM11/24/21
to django-...@googlegroups.com
#33315: A little question about writing your first Django application, Part 5
-------------------------------+--------------------------------------
Reporter: Rice-777 | Owner: nobody
Type: Bug | Status: closed
Component: Documentation | Version: 3.2
Severity: Normal | Resolution: invalid

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+--------------------------------------
Changes (by Mariusz Felisiak):

* status: new => closed
* resolution: => invalid


Comment:

Tutorial 05 works for me, it looks that you're using docs for a wrong
version of Django. Closing per TicketClosingReasons/UseSupportChannels.

--
Ticket URL: <https://code.djangoproject.com/ticket/33315#comment:1>

Reply all
Reply to author
Forward
0 new messages