当前位置: 首页>>代码示例>>Python>>正文


Python Question.was_published_recently方法代码示例

本文整理汇总了Python中models.Question.was_published_recently方法的典型用法代码示例。如果您正苦于以下问题:Python Question.was_published_recently方法的具体用法?Python Question.was_published_recently怎么用?Python Question.was_published_recently使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在models.Question的用法示例。


在下文中一共展示了Question.was_published_recently方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_was_published_recently_with_future_question

# 需要导入模块: from models import Question [as 别名]
# 或者: from models.Question import was_published_recently [as 别名]
 def test_was_published_recently_with_future_question(self):
     """
     was_published_recently() should return False for questions whose pub_date is in the future.
     """
     time = timezone.now() + datetime.timedelta(days=30)
     future_question = Question(pub_date=time)
     self.assertEqual(future_question.was_published_recently(), False)
开发者ID:nbkincaid,项目名称:django_project_tutorial,代码行数:9,代码来源:tests.py

示例2: test_was_published_recently_with_recent_question

# 需要导入模块: from models import Question [as 别名]
# 或者: from models.Question import was_published_recently [as 别名]
    def test_was_published_recently_with_recent_question(self):
	"""
	was_published_recently() should return True for questions whos pub_date is within the last day.
	"""
	time = timezone.now() + datetime.timedelta(hours=-1)
	recent_question=Question(pub_date=time)
	self.assertEqual(recent_question.was_published_recently(), True)
开发者ID:ghacer,项目名称:polls,代码行数:9,代码来源:tests.py

示例3: test_was_published_recently_wit_old_question

# 需要导入模块: from models import Question [as 别名]
# 或者: from models.Question import was_published_recently [as 别名]
    def test_was_published_recently_wit_old_question(self):
	"""
	was_published_recently() should return False for question whose pub_date is in within the last day
	"""
	time = timezone.now() + datetime.timedelta(days=-30)
	old_question = Question(pub_date=time)
	self.assertEqual(old_question.was_published_recently(), False)
开发者ID:ghacer,项目名称:polls,代码行数:9,代码来源:tests.py

示例4: test_was_published_recently_with_old_question

# 需要导入模块: from models import Question [as 别名]
# 或者: from models.Question import was_published_recently [as 别名]
 def test_was_published_recently_with_old_question(self):
     """
     was_published_recently() should return False for questions whose
     pub_date is older than 1 day.
     """
     time = timezone.now() - datetime.timedelta(days=30)
     old_question = Question(pub_date=time)
     self.assertEqual(old_question.was_published_recently(), False)
开发者ID:ohadb,项目名称:python_tries,代码行数:10,代码来源:tests.py

示例5: test_was_published_recently_with_future_question

# 需要导入模块: from models import Question [as 别名]
# 或者: from models.Question import was_published_recently [as 别名]
 def test_was_published_recently_with_future_question(self):
     time = timezone.now() + datetime.timedelta(days=30)
     future_question = Question(pub_date=time)
     self.assertEqual(future_question.was_published_recently(), False)
开发者ID:heyaoyu,项目名称:tutorial-sample-code,代码行数:6,代码来源:tests.py

示例6: test_was_recently_published_with_recent_question

# 需要导入模块: from models import Question [as 别名]
# 或者: from models.Question import was_published_recently [as 别名]
 def test_was_recently_published_with_recent_question(self):
     time = timezone.now() - datetime.timedelta(hours=1)
     recent_question = Question(pub_date=time)
     self.assertTrue(recent_question.was_published_recently())
开发者ID:sajeevnair,项目名称:django_tutorial,代码行数:6,代码来源:tests.py

示例7: test_was_recently_published_with_old_question

# 需要导入模块: from models import Question [as 别名]
# 或者: from models.Question import was_published_recently [as 别名]
 def test_was_recently_published_with_old_question(self):
     time = timezone.now() - datetime.timedelta(days=30)
     old_question = Question(pub_date=time)
     self.assertFalse(old_question.was_published_recently())
开发者ID:sajeevnair,项目名称:django_tutorial,代码行数:6,代码来源:tests.py


注:本文中的models.Question.was_published_recently方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。