當前位置: 首頁>>代碼示例>>Python>>正文


Python SectionPeriodFactory.create_batch方法代碼示例

本文整理匯總了Python中courses.tests.factories.SectionPeriodFactory.create_batch方法的典型用法代碼示例。如果您正苦於以下問題:Python SectionPeriodFactory.create_batch方法的具體用法?Python SectionPeriodFactory.create_batch怎麽用?Python SectionPeriodFactory.create_batch使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在courses.tests.factories.SectionPeriodFactory的用法示例。


在下文中一共展示了SectionPeriodFactory.create_batch方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: test_get_sections_by_semester

# 需要導入模塊: from courses.tests.factories import SectionPeriodFactory [as 別名]
# 或者: from courses.tests.factories.SectionPeriodFactory import create_batch [as 別名]
 def test_get_sections_by_semester(self):
     sem = SemesterFactory.create()
     s1, s2 = SectionPeriodFactory.create_batch(2, semester=sem)
     s3, s4 = SectionPeriodFactory.create_batch(2)
     json = self.json_get(
         'v4:sections', get='?semester_id=%d' % sem.id, status_code=200)
     self.assertEqual(json, {
         u"version": 4,
         u"success": True,
         u"result": [
             self.to_dict(s1),
             self.to_dict(s2),
         ]
     })
開發者ID:Radzell,項目名稱:YACS,代碼行數:16,代碼來源:tests.py

示例2: test_get_section_by_id

# 需要導入模塊: from courses.tests.factories import SectionPeriodFactory [as 別名]
# 或者: from courses.tests.factories.SectionPeriodFactory import create_batch [as 別名]
 def test_get_section_by_id(self):
     s1, s2 = SectionPeriodFactory.create_batch(2)
     json = self.json_get('v4:sections', id=s1.id, status_code=200)
     self.maxDiff = None
     self.assertEqual(json, {
         u"version": 4,
         u"success": True,
         u"result": self.to_dict(s1),
     })
開發者ID:Radzell,項目名稱:YACS,代碼行數:11,代碼來源:tests.py

示例3: test_get_sections

# 需要導入模塊: from courses.tests.factories import SectionPeriodFactory [as 別名]
# 或者: from courses.tests.factories.SectionPeriodFactory import create_batch [as 別名]
 def test_get_sections(self):
     s1, s2, s3, s4 = SectionPeriodFactory.create_batch(4)
     json = self.json_get('v4:sections', status_code=200)
     self.assertEqual(json, {
         u"version": 4,
         u"success": True,
         u"result": [
             self.to_dict(s1),
             self.to_dict(s2),
             self.to_dict(s3),
             self.to_dict(s4),
         ]
     })
開發者ID:Radzell,項目名稱:YACS,代碼行數:15,代碼來源:tests.py

示例4: test_get_sections_by_crn

# 需要導入模塊: from courses.tests.factories import SectionPeriodFactory [as 別名]
# 或者: from courses.tests.factories.SectionPeriodFactory import create_batch [as 別名]
 def test_get_sections_by_crn(self):
     s1, s2, s3, s4 = SectionPeriodFactory.create_batch(4)
     json = self.json_get(
         'v4:sections',
         get='?crn=%d&crn=%d' % (s1.section.crn, s3.section.crn),
         status_code=200)
     self.assertEqual(json, {
         u"version": 4,
         u"success": True,
         u"result": [
             self.to_dict(s1),
             self.to_dict(s3),
         ]
     })
開發者ID:Radzell,項目名稱:YACS,代碼行數:16,代碼來源:tests.py

示例5: test_get_sections_by_course

# 需要導入模塊: from courses.tests.factories import SectionPeriodFactory [as 別名]
# 或者: from courses.tests.factories.SectionPeriodFactory import create_batch [as 別名]
 def test_get_sections_by_course(self):
     c1 = CourseFactory.create()
     sec1, sec2 = SectionFactory.create_batch(2, course=c1)
     s1 = SectionPeriodFactory.create(section=sec1)
     s2 = SectionPeriodFactory.create(section=sec2)
     s3, s4 = SectionPeriodFactory.create_batch(2)
     json = self.json_get(
         'v4:sections', get='?course_id=%d' % c1.id, status_code=200)
     self.assertEqual(json, {
         u"version": 4,
         u"success": True,
         u"result": [
             self.to_dict(s1),
             self.to_dict(s2),
         ]
     })
開發者ID:Radzell,項目名稱:YACS,代碼行數:18,代碼來源:tests.py


注:本文中的courses.tests.factories.SectionPeriodFactory.create_batch方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。