Opened 3 years ago
Closed 3 years ago
#33315 closed Bug (invalid)
A little question about writing your first Django application, Part 5
Reported by: | Rice-777 | Owned by: | nobody |
---|---|---|---|
Component: | Documentation | Version: | 3.2 |
Severity: | Normal | Keywords: | |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
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.contextlatest_question_list, [question],)" to "assertEqual(list(response.contextlatest_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
Tutorial 05 works for me, it looks that you're using docs for a wrong version of Django. Closing per TicketClosingReasons/UseSupportChannels.