def test_is_valid_ko_short_timeline(self): empty_timeline = planning.from_parse_datetimes(a_format, 0, []) is_empty_valid = planning.is_valid(empty_timeline) self.assertFalse(is_empty_valid) only_one_event = [['2015-10-22 13:15:20', 'donald', 'mickey']] tooshort_timeline = planning.from_parse_datetimes(a_format, 0, only_one_event) is_too_short_valid = planning.is_valid(tooshort_timeline) self.assertFalse(is_too_short_valid)
def test_is_valid_ko_unsorted_timedates(self): unsorted_planning = planning.from_parse_datetimes(a_format, 0, [ ['2015-10-22 13:15:21', 'mickey', 'pluto', 'yay'], ['2015-10-22 13:15:20', 'donald', 'mickey'] ]) # second event ts is before firt's is_unsorted_valid = planning.is_valid(unsorted_planning) self.assertFalse(is_unsorted_valid)
def test_is_valid_ok(self): ok_planning = planning.from_parse_datetimes(a_format, 0, a_timeline) is_valid_ok_planning = planning.is_valid(ok_planning) self.assertTrue(is_valid_ok_planning)
def test_is_valid_ko_non_iterable(self): is_valid = planning.is_valid(234) self.assertFalse(is_valid)