summaryrefslogtreecommitdiff
path: root/docs/intro
diff options
context:
space:
mode:
authorHasan Ramezani <hasan.r67@gmail.com>2020-10-18 18:29:52 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2020-11-06 09:24:50 +0100
commit3f7b3275627385f8f7531fca01cdda50d4ec6b6e (patch)
treefb082d40e73f6c877911eab92229ac21cdfaa5bc /docs/intro
parent13b6fff11703a694e155b84d41d02822bbc0aaa0 (diff)
downloaddjango-3f7b3275627385f8f7531fca01cdda50d4ec6b6e.tar.gz
Fixed #31235 -- Made assertQuerysetEqual() compare querysets directly.
This also replaces assertQuerysetEqual() to assertSequenceEqual()/assertCountEqual() where appropriate. Co-authored-by: Peter Inglesby <peter.inglesby@gmail.com> Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Diffstat (limited to 'docs/intro')
-rw-r--r--docs/intro/tutorial05.txt14
1 files changed, 7 insertions, 7 deletions
diff --git a/docs/intro/tutorial05.txt b/docs/intro/tutorial05.txt
index 046abb8124..1ff868b1cb 100644
--- a/docs/intro/tutorial05.txt
+++ b/docs/intro/tutorial05.txt
@@ -498,11 +498,11 @@ class:
Questions with a pub_date in the past are displayed on the
index page.
"""
- create_question(question_text="Past question.", days=-30)
+ question = create_question(question_text="Past question.", days=-30)
response = self.client.get(reverse('polls:index'))
self.assertQuerysetEqual(
response.context['latest_question_list'],
- ['<Question: Past question.>']
+ [question],
)
def test_future_question(self):
@@ -520,24 +520,24 @@ class:
Even if both past and future questions exist, only past questions
are displayed.
"""
- create_question(question_text="Past question.", days=-30)
+ question = create_question(question_text="Past question.", days=-30)
create_question(question_text="Future question.", days=30)
response = self.client.get(reverse('polls:index'))
self.assertQuerysetEqual(
response.context['latest_question_list'],
- ['<Question: Past question.>']
+ [question],
)
def test_two_past_questions(self):
"""
The questions index page may display multiple questions.
"""
- create_question(question_text="Past question 1.", days=-30)
- create_question(question_text="Past question 2.", days=-5)
+ question1 = create_question(question_text="Past question 1.", days=-30)
+ question2 = create_question(question_text="Past question 2.", days=-5)
response = self.client.get(reverse('polls:index'))
self.assertQuerysetEqual(
response.context['latest_question_list'],
- ['<Question: Past question 2.>', '<Question: Past question 1.>']
+ [question2, question1],
)