# Tutorial 5 (Testing): test\_two\_past\_questions - AssertionError: Lists differ

**URL:** <https://forum.djangoproject.com/t/tutorial-5-testing-test-two-past-questions-assertionerror-lists-differ/12606>\
**Category:** Getting Started\
**Created:** [March 14, 2022, 8:01pm UTC](https://forum.djangoproject.com/t/tutorial-5-testing-test-two-past-questions-assertionerror-lists-differ/12606 "2022-03-14T20:01:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkelly255](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/dkelly255/32/7448_2.png) [@dkelly255](https://forum.djangoproject.com/u/dkelly255)\
**Post date:** [March 14, 2022, 8:01pm UTC](https://forum.djangoproject.com/t/tutorial-5-testing-test-two-past-questions-assertionerror-lists-differ/12606/1 "2022-03-14T20:01:18Z")

</div>

Hi, I have encountered a difficulty in one of tutorial 5’s automated tests (9 of the 10 tests pass, but this test fails). The `test_two_past_questions(self):` fails for me with the following error in the command line:

```auto
Traceback (most recent call last):
  File "/workspace/pp4-django-blog/poll/tests.py", line 104, in test_two_past_questions
    self.assertQuerysetEqual(
  File "/workspace/.pip-modules/lib/python3.8/site-packages/django/test/testcases.py", line 1072, in assertQuerysetEqual
    return self.assertEqual(list(items), values, msg=msg)
AssertionError: Lists differ: [<Question: Past question 1.>, <Question: Past question 2.>] != [<Question: Past question 2.>, <Question: Past question 1.>]

First differing element 0:
<Question: Past question 1.>
<Question: Past question 2.>

- [<Question: Past question 1.>, <Question: Past question 2.>]
? ^ ^

+ [<Question: Past question 2.>, <Question: Past question 1.>]
? ^ ^

```

The test code I have is pasted below (matches to the tutorial test code):

```auto
def test_two_past_questions(self):
        """
        The questions index page may display multiple questions.
        """
        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('poll:index'))
        self.assertQuerysetEqual(
            response.context['latest_question_list'],
            [question2, question1],
        )

```

And when I load my polls page/index.html, it does display multiple questions, so I am not sure how to resolve this

Thanks in advance for any clarifications you may be able to provide

---

<div class="post-metadata">

**Author:** ![dkelly255](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/dkelly255/32/7448_2.png) [@dkelly255](https://forum.djangoproject.com/u/dkelly255)\
**Post date:** [March 14, 2022, 8:41pm UTC](https://forum.djangoproject.com/t/tutorial-5-testing-test-two-past-questions-assertionerror-lists-differ/12606/2 "2022-03-14T20:41:12Z")

</div>

Sorry folks I think i may know what this is - i changed the “order by” in the view to make the questions appear in sequential order (1,2,3) instead of (3,2,1) and i think will almost certainly be the problem, apologies, am just reloading workspace & rechecking now

---

<div class="post-metadata">

**Author:** ![dkelly255](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/dkelly255/32/7448_2.png) [@dkelly255](https://forum.djangoproject.com/u/dkelly255)\
**Post date:** [March 14, 2022, 8:44pm UTC](https://forum.djangoproject.com/t/tutorial-5-testing-test-two-past-questions-assertionerror-lists-differ/12606/3 "2022-03-14T20:44:59Z")

</div>

Yes that fixed it, i needed to just amend the test questions to the below:

```auto
question1 = create_question(question_text="Past question 1.", days=-5)
question2 = create_question(question_text="Past question 2.", days=-30)

```

versus the original:

```auto
question1 = create_question(question_text="Past question 1.", days=-30)
question2 = create_question(question_text="Past question 2.", days=-5)

```

My bad, apologies!
