def test_one_date_range(self): self.assertEqual( datetools.DateSequence([ datetools.DateRange( datetime.date(2018, 9, 13), datetime.date(2018, 9, 14))]), datetools.parse_date_sequence('2018-09-13..2018-09-14'))
def test_comma_only(self): self.assertEqual( datetools.DateSequence([]), datetools.parse_date_sequence(',') )
def test_empty_string(self): self.assertEqual( datetools.DateSequence([]), datetools.parse_date_sequence('') )
def test_none(self): with self.assertRaises(datetools.DateParsingError): datetools.parse_date_sequence(None)
def test_two_dates_on_separate_lines(self): test_file_path = self._create_test_file('2019-05-21\n2019-05-22') self.assertEqual( datetools.parse_date_sequence('2019-05-21,2019-05-22'), datetools.parse_date_sequence_file(test_file_path) )
def test_single_date_with_trailing_newline(self): test_file_path = self._create_test_file('2019-05-21\n') self.assertEqual( datetools.parse_date_sequence('2019-05-21'), datetools.parse_date_sequence_file(test_file_path) )
def test_two_dates(self): self.assertEqual( datetools.DateSequence( [datetime.date(2018, 9, 13), datetime.date(2018, 9, 14)]), datetools.parse_date_sequence('2018-09-13,2018-09-14'))