def test_csmapper_get_groups(self):
        s, f = CourseStringMapper.get_groups('20101SCNC1000F001')
        assert s is not None
        assert f is not None
        s, f = CourseStringMapper.get_groups(WindTemplate.example)
        assert s is not None
        assert f is not None

        s, f = CourseStringMapper.get_groups("something completely invalid")
        assert s is None
        assert f is None
예제 #2
0
    def test_csmapper_get_groups(self):
        s, f = CourseStringMapper.get_groups('20101SCNC1000F001')
        self.assertIsNotNone(s)
        self.assertIsNotNone(f)
        s, f = CourseStringMapper.get_groups(WindTemplate.example)
        self.assertIsNotNone(s)
        self.assertIsNotNone(f)

        s, f = CourseStringMapper.get_groups("something completely invalid")
        self.assertIsNone(s)
        self.assertIsNone(f)
예제 #3
0
    def test_windtemplate(self):
        example = 't3.y2007.s001.cw3956.engl.fc.course:columbia.edu'
        # round-trip it
        self.assertEqual(
            WindTemplate.to_string(WindTemplate.to_dict(example)),
            example)

        example = 't3.y2007.sd21.cw3956.engl.fc.course:columbia.edu'
        # round-trip it
        self.assertEqual(
            WindTemplate.to_string(WindTemplate.to_dict(example)),
            example)
        self.assertEqual(
            CourseStringMapper.to_string(CourseStringMapper.to_dict(example)),
            example)
    def test_csmapper_course_slug(self):
        class StubGroup(object):
            name = 't3.y2007.s001.cw3956.engl.fc.course:columbia.edu'

        class StubCourse(object):
            def __init__(self):
                self.group = StubGroup()
        self.assertEquals(
            CourseStringMapper.course_slug(StubCourse()),
            'CUengl3956')
 def test_csmapper_widget(self):
     self.assertEquals(
         CourseStringMapper.widget().clean('20101SCNC1000F001'),
         '20101SCNC1000F001')