本文整理匯總了Python中courses.tests.factories.SectionPeriodFactory.build方法的典型用法代碼示例。如果您正苦於以下問題:Python SectionPeriodFactory.build方法的具體用法?Python SectionPeriodFactory.build怎麽用?Python SectionPeriodFactory.build使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類courses.tests.factories.SectionPeriodFactory
的用法示例。
在下文中一共展示了SectionPeriodFactory.build方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_conflicts_with_uses_period_conflict
# 需要導入模塊: from courses.tests.factories import SectionPeriodFactory [as 別名]
# 或者: from courses.tests.factories.SectionPeriodFactory import build [as 別名]
def test_conflicts_with_uses_period_conflict(self):
period1 = PeriodFactory.build()
period1.conflicts_with = Mock(return_value=False)
period2 = PeriodFactory.build()
sp1 = SectionPeriodFactory.build(period=period1)
sp2 = SectionPeriodFactory.build(period=period2)
self.assertFalse(sp1.conflicts_with(sp2))
period1.conflicts_with.assert_called_with(period2)
示例2: test_to_json
# 需要導入模塊: from courses.tests.factories import SectionPeriodFactory [as 別名]
# 或者: from courses.tests.factories.SectionPeriodFactory import build [as 別名]
def test_to_json(self):
period = PeriodFactory.build()
period.toJSON = Mock(return_value={'lol': 1})
sp = SectionPeriodFactory.build(
id=None,
instructor='foo',
location='bar',
kind='fizz',
period=period,
)
expected = {
'instructor': 'foo',
'location': 'bar',
'kind': 'fizz',
'lol': 1,
'id': None,
}
self.assertEqual(expected, sp.toJSON())