Пример #1
0
 def test_was_recently_published_recent_question(self):
     time = timezone.now() - datetime.timedelta(
         hours=23, minutes=59, seconds=59)
     recent = Question(pub_date=time)
     self.assertIs(recent.was_recently_published(), True)
Пример #2
0
 def test_was_recently_published_older_question(self):
     time = timezone.now() - datetime.timedelta(days=1, seconds=1)
     older = Question(pub_date=time)
     self.assertIs(older.was_recently_published(), False)
Пример #3
0
 def test_was_recently_published_future_question(self):
     time = timezone.now() + datetime.timedelta(days=30)
     future = Question(pub_date=time)
     self.assertIs(future.was_recently_published(), False)