Re: [Django] #32816: QuerysetEqual Test error on the polls app.

2022-10-08 Thread Django
#32816: QuerysetEqual Test error on the polls app.
-+-
 Reporter:  Hassan   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Documentation|  Version:  3.2
 Severity:  Normal   |   Resolution:  invalid
 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 Mariusz Felisiak):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 Gopal, please don't re-open old tickets. First of all, your issue has
 nothing to do with the problem reported in the ticket description.
 Secondly, tutorial works for me. It looks that you missed point about
 [https://docs.djangoproject.com/en/3.0/intro/tutorial05/#improving-our-
 view improving your view]. If you're having trouble understanding how
 Django works, see TicketClosingReasons/UseSupportChannels for ways to get
 help.

-- 
Ticket URL: 
Django 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070183b89f9163-74ae9b4d-0345-4205-a133-bec6e8146006-00%40eu-central-1.amazonses.com.


Re: [Django] #32816: QuerysetEqual Test error on the polls app.

2022-10-08 Thread Django
#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'],
 [''])

 }}}


 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: 
Django 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070183b7c6a451-2fce588b-3eee-442e-b695-a36292ade62e-00%40eu-central-1.amazonses.com.


Re: [Django] #32816: QuerysetEqual Test error on the polls app.

2021-06-04 Thread Django
#32816: QuerysetEqual Test error on the polls app.
-+-
 Reporter:  MesteRobot   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Documentation|  Version:  3.2
 Severity:  Normal   |   Resolution:  invalid
 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 Mariusz Felisiak):

 * status:  new => closed
 * resolution:   => invalid
 * has_patch:  1 => 0
 * component:  Testing framework => Documentation


Comment:

 Tutorial works for me. It looks that you're using docs for Django 3.2+
 with older version of Django.

-- 
Ticket URL: 
Django 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/068.b8554b6975c92dd7aca22ec2c532365a%40djangoproject.com.


[Django] #32816: QuerysetEqual Test error on the polls app.

2021-06-04 Thread Django
#32816: QuerysetEqual Test error on the polls app.
-+-
   Reporter: |  Owner:  nobody
  MesteRobot |
   Type:  Bug| Status:  new
  Component:  Testing|Version:  3.2
  framework  |   Keywords:  Polls, Test,
   Severity:  Normal |  QuerysetEqual
   Triage Stage: |  Has patch:  1
  Unreviewed |
Needs documentation:  0  |Needs tests:  0
Patch needs improvement:  0  |  Easy pickings:  0
  UI/UX:  0  |
-+-
 Hello.

 I walk through the polls app tutorial ... I found an error in the code on
 part5 of the tutorial;

 {{{
 #!div style="font-size: 80%"
 Code highlighting:
   {{{#!python
 def test_past_question(self):
 """
 Questions with a pub_date in the past are displayed on the
 index page.
 """
 question = create_question("Past question.", -30)
 response = self.client.get(reverse("polls:index"))
 self.assertQuerysetEqual(
 response.context["latest_question_list"],
 [question]
 )

 def test_future_question_and_past_question(self):
 """
 Even if both past and future questions exist, only past questions
 are displayed.
 """
 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.
 """
 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],
 )
 }}}
 }}}


 when i run the test i saw this error message:

 {{{
 Creating test database for alias 'default'...
 System check identified no issues (0 silenced).
 .F.FF...
 ==
 FAIL: test_future_question_and_past_question
 (polls.tests.QuestionIndexViewTest)
 --
 Traceback (most recent call last):
   File "D:\Samples\Django\mysite-project\polls\tests.py", line 58, in
 test_future_question_and_past_question
 self.assertQuerysetEqual(
   File "C:\Users\Mr.Robot\AppData\Roaming\Python\Python39\site-
 packages\django\test\testcases.py", line 1052, in assertQuerysetEqual
 return self.assertEqual(list(items), values, msg=msg)
 AssertionError: Lists differ: [''] !=
 []

 First differing element 0:
 ''
 

 - ['']
 ?  -  -

 + []

 ==
 FAIL: test_past_question (polls.tests.QuestionIndexViewTest)
 --
 Traceback (most recent call last):
   File "D:\Samples\Django\mysite-project\polls\tests.py", line 43, in
 test_past_question
 self.assertQuerysetEqual(
   File "C:\Users\Mr.Robot\AppData\Roaming\Python\Python39\site-
 packages\django\test\testcases.py", line 1052, in assertQuerysetEqual
 return self.assertEqual(list(items), values, msg=msg)
 AssertionError: Lists differ: [''] !=
 []

 First differing element 0:
 ''
 

 - ['']
 ?  -  -

 + []

 ==
 FAIL: test_two_past_question (polls.tests.QuestionIndexViewTest)
 --
 Traceback (most recent call last):
   File "D:\Samples\Django\mysite-project\polls\tests.py", line 67, in
 test_two_past_question
 self.assertQuerysetEqual(
   File "C:\Users\Mr.Robot\AppData\Roaming\Python\Python39\site-
 packages\django\test\testcases.py", line 1052, in assertQuerysetEqual
 return self.assertEqual(list(items), values, msg=msg)
 AssertionError: Lists differ: ['', ''] != [, ]

 First differing element 0:
 ''
 

 - ['', '']
 ?  --  --

 + [, ]

 --
 Ran 8 tests in 0.126s

 FAILED (failures=3)
 Destroying test database for alias 'default'...
 }}}

 So i search the web for solution and i found that on stackoverflow.com: