def test_sis_id(self):
        section = CanvasSection()

        # Missing section ID
        self.assertEquals(section.sws_section_id(), None)
        self.assertEquals(section.sws_instructor_regid(), None)
        self.assertEquals(section.is_academic_sis_id(), False)

        # Valid section IDs
        section = CanvasSection(sis_section_id="2013-spring-PHYS-121-A--")
        self.assertEquals(section.sws_section_id(), "2013,spring,PHYS,121/A")
        self.assertEquals(section.sws_instructor_regid(), None)
        self.assertEquals(section.is_academic_sis_id(), True)

        section = CanvasSection(sis_section_id="2013-spring-PHYS-121-AB")
        self.assertEquals(section.sws_section_id(), "2013,spring,PHYS,121/AB")
        self.assertEquals(section.sws_instructor_regid(), None)
        self.assertEquals(section.is_academic_sis_id(), True)

        section = CanvasSection(sis_section_id="2013-autumn-GEN ST-199-A7--")
        self.assertEquals(section.sws_section_id(),
                          "2013,autumn,GEN ST,199/A7")

        section = CanvasSection(sis_section_id=(
            "2013-spring-PHYS-599-A-9136CCB8F66711D5BE060004AC494FFE--"))
        self.assertEquals(section.sws_section_id(), "2013,spring,PHYS,599/A")
        self.assertEquals(section.sws_instructor_regid(),
                          "9136CCB8F66711D5BE060004AC494FFE")
        self.assertEquals(section.is_academic_sis_id(), True)

        # Invalid section IDs
        section = CanvasSection(sis_section_id="2013-spring-PHYS-121-A")
        self.assertEquals(section.sws_section_id(), None)

        section = CanvasSection(sis_section_id="2013-spring-PHYS-121-A-")
        self.assertEquals(section.sws_section_id(), None)

        section = CanvasSection(sis_section_id=(
            "2013-spring-PHYS-599-A-9136CCB8F66711D5BE060004AC494FFE"))
        self.assertEquals(section.sws_section_id(), None)

        section = CanvasSection(sis_section_id=(
            "2013-spring-PHYS-599-A-9136CCB8F66711D5BE060004AC494FFE-"))
        self.assertEquals(section.sws_section_id(), None)

        section = CanvasSection(sis_section_id="course_123456_groups")
        self.assertEquals(section.sws_section_id(), None)
        self.assertEquals(section.sws_instructor_regid(), None)
        self.assertEquals(section.is_academic_sis_id(), False)
def section_label_from_section_id(section_id):
    canvas_section = CanvasSection(sis_section_id=section_id)
    section_label = canvas_section.sws_section_id()
    if section_label is None:
        valid_academic_course_sis_id(section_id)
        canvas_course = CanvasCourse(sis_course_id=section_id)
        section_label = canvas_course.sws_course_id()
    return section_label