コード例 #1
0
def _parse_unavailable_time(avail) -> UnavailableTime:
    """ Parses an availability input and convert it to an UnavailableTime object
        to be used in create_schedules
    """

    start_time = convert_meeting_time(avail["startTime"])
    end_time = convert_meeting_time(avail["endTime"])
    day = avail["day"]

    return UnavailableTime(start_time, end_time, day)
コード例 #2
0
    def test_convert_meeting_time_handles_null_time(self):
        """ Tests that scrape_courses.convert_meeting_time can handle Null times """

        # Act
        time = convert_meeting_time(None)

        # Assert
        self.assertIsNone(time)
コード例 #3
0
    def test_convert_meeting_time_returns_correct_time(self):
        """ Tests that scrape_courses.convert_meeting_time can handle a normal time """

        # Act
        time = convert_meeting_time("1230")

        # Assert
        self.assertEqual(time, datetime.time(12, 30))