From 3f7b3275627385f8f7531fca01cdda50d4ec6b6e Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Sun, 18 Oct 2020 18:29:52 +0200 Subject: Fixed #31235 -- Made assertQuerysetEqual() compare querysets directly. This also replaces assertQuerysetEqual() to assertSequenceEqual()/assertCountEqual() where appropriate. Co-authored-by: Peter Inglesby Co-authored-by: Mariusz Felisiak --- docs/intro/tutorial05.txt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'docs/intro') 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], ) 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], ) 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'], - ['', ''] + [question2, question1], ) -- cgit v1.2.1