#23654: test_index_view_with_two_past_questions() raising ValueError
-------------------------------+--------------------
     Reporter:  skalrynd       |      Owner:  nobody
         Type:  Uncategorized  |     Status:  new
    Component:  Documentation  |    Version:  1.7
     Severity:  Normal         |   Keywords:
 Triage Stage:  Unreviewed     |  Has patch:  0
Easy pickings:  0              |      UI/UX:  0
-------------------------------+--------------------
 While following tutorial 5 and executing the test at:
 https://docs.djangoproject.com/en/1.7/intro/tutorial05/

 I got a raised exception:

 {{{
 Traceback (most recent call last):
   File "/var/www/project.com/project/polls/tests.py", line 97, in
 test_index_view_with_two_past_questions
     ['<Question: Past question 2.>', '<Question: Past question 1.>']
   File "/usr/local/lib/python3.4/dist-packages/django/test/testcases.py",
 line 853, in assertQuerysetEqual
     raise ValueError("Trying to compare non-ordered queryset "
 ValueError: Trying to compare non-ordered queryset against more than one
 ordered values
 }}}


 I found the error to be resolved using list():

 {{{
 def test_index_view_with_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)
         response = self.client.get(reverse('polls:index'))
         self.assertQuerysetEqual(
             list(response.context['latest_question_list']),
             list(['<Question: Past question 2.>', '<Question: Past
 question 1.>'])
         )
 }}}

--
Ticket URL: <https://code.djangoproject.com/ticket/23654>
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 django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/051.3d46414ff8200d0868cb1c97f9322bf1%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to