mirror of
https://github.com/django/django.git
synced 2025-10-23 21:59:11 +00:00
[1.10.x] Fixed #26021 -- Applied hanging indentation to docs.
Backport of 4a4d7f980e from master
This commit is contained in:
@@ -462,8 +462,7 @@ class:
|
||||
in the past, positive for questions that have yet to be published).
|
||||
"""
|
||||
time = timezone.now() + datetime.timedelta(days=days)
|
||||
return Question.objects.create(question_text=question_text,
|
||||
pub_date=time)
|
||||
return Question.objects.create(question_text=question_text, pub_date=time)
|
||||
|
||||
|
||||
class QuestionViewTests(TestCase):
|
||||
@@ -495,8 +494,7 @@ class:
|
||||
"""
|
||||
create_question(question_text="Future question.", days=30)
|
||||
response = self.client.get(reverse('polls:index'))
|
||||
self.assertContains(response, "No polls are available.",
|
||||
status_code=200)
|
||||
self.assertContains(response, "No polls are available.")
|
||||
self.assertQuerysetEqual(response.context['latest_question_list'], [])
|
||||
|
||||
def test_index_view_with_future_question_and_past_question(self):
|
||||
@@ -580,10 +578,9 @@ in the future is not:
|
||||
The detail view of a question with a pub_date in the future should
|
||||
return a 404 not found.
|
||||
"""
|
||||
future_question = create_question(question_text='Future question.',
|
||||
days=5)
|
||||
response = self.client.get(reverse('polls:detail',
|
||||
args=(future_question.id,)))
|
||||
future_question = create_question(question_text='Future question.', days=5)
|
||||
url = reverse('polls:detail', args=(future_question.id,))
|
||||
response = self.client.get(url)
|
||||
self.assertEqual(response.status_code, 404)
|
||||
|
||||
def test_detail_view_with_a_past_question(self):
|
||||
@@ -591,13 +588,10 @@ in the future is not:
|
||||
The detail view of a question with a pub_date in the past should
|
||||
display the question's text.
|
||||
"""
|
||||
past_question = create_question(question_text='Past Question.',
|
||||
days=-5)
|
||||
response = self.client.get(reverse('polls:detail',
|
||||
args=(past_question.id,)))
|
||||
self.assertContains(response, past_question.question_text,
|
||||
status_code=200)
|
||||
|
||||
past_question = create_question(question_text='Past Question.', days=-5)
|
||||
url = reverse('polls:detail', args=(past_question.id,))
|
||||
response = self.client.get(url)
|
||||
self.assertContains(response, past_question.question_text)
|
||||
|
||||
Ideas for more tests
|
||||
--------------------
|
||||
|
||||
Reference in New Issue
Block a user