#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.
--
You received this message because you are subscribed to the Google Groups
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/051.26eb07f5f7c7ce0d6b387b98d8f1404a%40djangoproject.com.