本文整理汇总了Python中courses.tests.factories.CourseFactory.build方法的典型用法代码示例。如果您正苦于以下问题:Python CourseFactory.build方法的具体用法?Python CourseFactory.build怎么用?Python CourseFactory.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类courses.tests.factories.CourseFactory
的用法示例。
在下文中一共展示了CourseFactory.build方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_available_sections
# 需要导入模块: from courses.tests.factories import CourseFactory [as 别名]
# 或者: from courses.tests.factories.CourseFactory import build [as 别名]
def test_available_sections(self):
course = CourseFactory.build()
queryset = models.Course.sections.by_availability = Mock(return_value='foobar')
self.assertEqual('foobar', course.available_sections)
queryset.assert_called_with()
示例2: test_credits_display_for_range
# 需要导入模块: from courses.tests.factories import CourseFactory [as 别名]
# 或者: from courses.tests.factories.CourseFactory import build [as 别名]
def test_credits_display_for_range(self):
course = CourseFactory.build(min_credits=1, max_credits=8)
self.assertEqual('1 - 8 credits', course.credits_display)
示例3: test_credits_display_for_equivalent_min_and_max_credits
# 需要导入模块: from courses.tests.factories import CourseFactory [as 别名]
# 或者: from courses.tests.factories.CourseFactory import build [as 别名]
def test_credits_display_for_equivalent_min_and_max_credits(self):
course = CourseFactory.build(min_credits=4, max_credits=4)
self.assertEqual('4 credits', course.credits_display)
示例4: test_credits_display_for_equivalent_min_and_max_credits_as_one_credit
# 需要导入模块: from courses.tests.factories import CourseFactory [as 别名]
# 或者: from courses.tests.factories.CourseFactory import build [as 别名]
def test_credits_display_for_equivalent_min_and_max_credits_as_one_credit(self):
course = CourseFactory.build(min_credits=1, max_credits=1)
self.assertEqual('1 credit', course.credits_display)
示例5: test_code
# 需要导入模块: from courses.tests.factories import CourseFactory [as 别名]
# 或者: from courses.tests.factories.CourseFactory import build [as 别名]
def test_code(self):
dept = DepartmentFactory.build(code='CSCI')
course = CourseFactory.build(department=dept, number=1100)
self.assertEqual('CSCI 1100', course.code)