#32816: QuerysetEqual Test error on the polls app.
-------------------------------------+-------------------------------------
Reporter: Hassan | Owner: nobody
Type: Bug | Status: new
Component: Documentation | Version: 3.2
Severity: Normal | Resolution:
Keywords: Polls, Test, | Triage Stage:
QuerysetEqual | Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by dasbairagya):
* status: closed => new
* resolution: invalid =>
Comment:
Hello there I'm completely agree with @hasan please fix that for version 3
{{{
def test_past_question(self):
"""
Questions with a pub_date in the past are displayed on the
index page.
"""
question = create_question(question_text="Past question.",
days=-30)
response = self.client.get(reverse('polls:index'))
# print('####latest_question_list####',
response.context['latest_question_list'], end='\n')
# print('####question####', question, end='\n')
self.assertQuerysetEqual(response.context['latest_question_list'],
[question])
def test_future_question(self):
"""
Questions with a pub_date in the future aren't displayed on
the index page.
"""
create_question(question_text="Future question.", days=30)
response = self.client.get(reverse('polls:index'))
self.assertContains(response, "No polls are available.")
self.assertQuerysetEqual(response.context['latest_question_list'],
[])
def test_past_future_question(self):
question = create_question(question_text="Past question.",
days=-30)
create_question(question_text="Future question.", days=30)
response = self.client.get(reverse('polls:index'))
# print('RESPONSE=> ', response.context)
self.assertQuerysetEqual(response.context['latest_question_list'],
['<Question: Past question.>'])
}}}
the 'test_past_question' is passed but 'test_future_question' is not but
if I write
{{{
self.assertQuerysetEqual(response.context['latest_question_list'],
[question])
}}}
in 'test_future_question' it will again pass
so it is a genuine issue please don't ignore. Because this problem is
blocking to clear the hackerrank hands-on as well and problem is we can't
modify the test case file in hackerrank.
--
Ticket URL: <https://code.djangoproject.com/ticket/32816#comment:2>
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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-updates/01070183b7c6a451-2fce588b-3eee-442e-b695-a36292ade62e-000000%40eu-central-1.amazonses.com.