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


Python factories.SemesterFactory类代码示例

本文整理汇总了Python中courses.tests.factories.SemesterFactory的典型用法代码示例。如果您正苦于以下问题:Python SemesterFactory类的具体用法?Python SemesterFactory怎么用?Python SemesterFactory使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: test_get_semesters_with_one_semester

 def test_get_semesters_with_one_semester(self):
     semester = SemesterFactory.create()
     json = self.json_get('v2:semesters', status_code=200)
     obj = json['payload']
     expected_item = semester.toJSON()
     date_updated = expected_item['date_updated']
     expected_item['date_updated'] = date_updated.isoformat()
     self.assertEqual([expected_item], obj)
开发者ID:Radzell,项目名称:YACS,代码行数:8,代码来源:tests.py

示例2: setUp

 def setUp(self):
     self.now = datetime.datetime.now().replace(microsecond=0)
     self.sem = SemesterFactory.create(
         id=1,
         year=2011,
         month=2,
         name='foo',
         date_updated=self.now
     )
开发者ID:jeffh,项目名称:YACS,代码行数:9,代码来源:test_models.py

示例3: setUp

    def setUp(self):
        self.sem = SemesterFactory.create(year=2011, month=1)
        self.dept = DepartmentFactory.create(code='CSCI')
        SemesterDepartmentFactory.create(department=self.dept, semester=self.sem)

        self.course = CourseFactory.create(number=2222, department=self.dept)
        OfferedForFactory.create(course=self.course, semester=self.sem)

        self.section = SectionFactory.create(course=self.course, semester=self.sem)
        SectionPeriodFactory.create(section=self.section)
开发者ID:TimeFinders,项目名称:YAExS,代码行数:10,代码来源:querysets.py

示例4: test_get_semester_by_id

    def test_get_semester_by_id(self):
        s3 = SemesterFactory.create()
        json = self.json_get('v4:semesters', id=s3.id)

        # for some odd reason, accuracy is lost for datetimes.
        json['result']['date_updated'] = json['result']['date_updated'][:-7]

        self.assertEqual(json, {
            u"version": 4,
            u"success": True,
            u"result": self.as_dict(s3),
        })
开发者ID:Radzell,项目名称:YACS,代码行数:12,代码来源:tests.py

示例5: test_get_sections_by_semester

 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,代码行数:14,代码来源:tests.py

示例6: setUp

    def setUp(self):
        semester = SemesterFactory.create(year=2011, month=1)
        course = CourseFactory.create(pk=2)
        OfferedForFactory.create(semester=semester, course=course)

        section = SectionFactory.create(number=1, course=course, semester=semester)
        sa_section = SectionFactory.create(number=models.Section.STUDY_ABROAD, course=course, semester=semester)
        crn_section = SectionFactory.create(crn=13337, course=course, semester=semester)

        cs_dept = DepartmentFactory.create(code='CSCI')
        SemesterDepartmentFactory.create(semester=semester, department=cs_dept)

        ecse_dept = DepartmentFactory.create(code='ECSE')
        SemesterDepartmentFactory.create(semester=semester, department=ecse_dept)

        self.semester, self.course, self.cs_dept, self.ecse_dept = semester, course, cs_dept, ecse_dept
开发者ID:Radzell,项目名称:YACS,代码行数:16,代码来源:smokes.py

示例7: test_get_semesters_by_ids

    def test_get_semesters_by_ids(self):
        s3 = SemesterFactory.create()
        json = self.json_get(
            'v4:semesters', get='?id=%d&id=%d' % (s3.id, self.s2.id))

        # for some odd reason, accuracy is lost for datetimes.
        for row in json['result']:
            row['date_updated'] = row['date_updated'][:-7]

        self.assertEqual(json, {
            u"version": 4,
            u"success": True,
            u"result": [
                self.as_dict(s3),
                self.as_dict(self.s2),
            ]
        })
开发者ID:Radzell,项目名称:YACS,代码行数:17,代码来源:tests.py

示例8: test_get_departments_by_semester

    def test_get_departments_by_semester(self):
        s1, s2 = SemesterFactory.create_batch(2)
        d1, d2, d3 = DepartmentFactory.create_batch(3)
        SemesterDepartmentFactory.create(semester=s1, department=d1)
        SemesterDepartmentFactory.create(semester=s1, department=d2)
        SemesterDepartmentFactory.create(semester=s2, department=d3)

        json = self.json_get(
            'v4:departments',
            get='?semester_id=%d' % s1.id,
            status_code=200)

        self.assertEqual(json, {
            u"version": 4,
            u"success": True,
            u"result": [
                self.as_dict(d1),
                self.as_dict(d2),
            ]
        })
开发者ID:Radzell,项目名称:YACS,代码行数:20,代码来源:tests.py

示例9: setUp

    def setUp(self):
        self.semester = SemesterFactory.create(year=2011, month=1)

        self.course1 = CourseFactory.create(id=1, min_credits=4, max_credits=4)
        OfferedForFactory.create(course=self.course1, semester=self.semester)
        self.course2 = CourseFactory.create(id=2, min_credits=4, max_credits=4)
        OfferedForFactory.create(course=self.course2, semester=self.semester)

        self.periods = create_periods(
            ((10, 0), (11, 50), models.Period.MONDAY | models.Period.THURSDAY),  # 0
            ((10, 0), (10, 50), models.Period.MONDAY | models.Period.THURSDAY),  # 1
            ((11, 0), (11, 50), models.Period.TUESDAY | models.Period.FRIDAY),  # 2
            ((12, 0), (13, 50), models.Period.TUESDAY | models.Period.FRIDAY),  # 3
            ((14, 0), (16, 50), models.Period.WEDNESDAY),  # 4
            ((10, 0), (10, 50), models.Period.TUESDAY | models.Period.FRIDAY),  # 5
            ((10, 0), (11, 50), models.Period.TUESDAY | models.Period.FRIDAY),  # 6
        )
        # conflicts: (0, 1), (2, 3), (5, 6)

        self.section1 = create_section(
            id=1,
            course=self.course1,
            crn=1000,
            number=1,
            seats_taken=3,
            seats_total=10,
            semester=self.semester,
            periods=[
                dict(period=self.periods[0], semester=self.semester),
                dict(period=self.periods[4], semester=self.semester),
            ],
        )
        self.section2 = create_section(
            id=2,
            course=self.course1,
            crn=1001,
            number=2,
            seats_taken=4,
            seats_total=5,
            semester=self.semester,
            periods=[
                dict(period=self.periods[1], semester=self.semester),
            ],
        )
        self.section3 = create_section(
            id=3,
            course=self.course2,
            crn=1002,
            number=1,
            seats_taken=4,
            seats_total=6,
            semester=self.semester,
            periods=[
                dict(period=self.periods[4], semester=self.semester),
            ],
        )
        self.section4 = create_section(
            id=4,
            course=self.course2,
            crn=1003,
            number=2,
            seats_taken=7,
            seats_total=6,
            semester=self.semester,
            periods=[
                dict(period=self.periods[5], semester=self.semester),
            ]
        )
        # can't figure out where the other semester objects get created
        # its do to get(models.Section, ...) but not sure where
        #models.Semester.objects.filter(id__gt=self.semester.id).delete()
        cache_conflicts(semester=self.semester)
开发者ID:Lucky1313,项目名称:YACS,代码行数:72,代码来源:tests.py

示例10: setUp

 def setUp(self):
     self.s1 = SemesterFactory.create(year=2011)
     self.s2 = SemesterFactory.create(year=2012, month=9)
开发者ID:Radzell,项目名称:YACS,代码行数:3,代码来源:tests.py

示例11: test_ics

 def test_ics(self):
     # FIXME: remove http request dependency
     semester = SemesterFactory.create(year=2012, month=9)
     sections = SectionFactory.create_batch(3, semester=semester)
     crns = [str(s.crn) for s in sections]
     response = self.get('ics', get='?crn=' + '&crn='.join(crns), status_code=200)
开发者ID:mdznr,项目名称:YACS,代码行数:6,代码来源:tests.py


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