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_beforeFirstOfOpenLastRange(self): self.assertFalse( datetime.date(2018, 9, 11) in datetools.DateRange( datetime.date(2018, 9, 12), None))
def test_onFirstOfOpenLastRange(self): self.assertTrue( datetime.date(2018, 9, 12) in datetools.DateRange( datetime.date(2018, 9, 12), None))
def test_afterLastOfOpenFirstRange(self): self.assertFalse( datetime.date(2018, 9, 15) in datetools.DateRange( None, datetime.date(2018, 9, 14)))
def test_onLastOfOpenFirstRange(self): self.assertTrue( datetime.date(2018, 9, 14) in datetools.DateRange( None, datetime.date(2018, 9, 14)))
def test_afterLstOfBoundedRange(self): self.assertFalse( datetime.date(2018, 9, 15) in datetools.DateRange( datetime.date(2018, 9, 12), datetime.date(2018, 9, 14)))
def test_beforeFirstOfBoundedRange(self): self.assertFalse( datetime.date(2018, 9, 11) in datetools.DateRange( datetime.date(2018, 9, 12), datetime.date(2018, 9, 14)))
def test_lastOfBoundedRange(self): self.assertTrue( datetime.date(2018, 9, 14) in datetools.DateRange( datetime.date(2018, 9, 12), datetime.date(2018, 9, 14)))
def test_None(self): with self.assertRaises(TypeError): None in datetools.DateRange( datetime.date(2018, 9, 12), datetime.date(2018, 9, 14))
def test_adjacentDates(self): self.assertEqual( datetools.DateRange( datetime.date(2018, 9, 14), datetime.date(2018, 9, 15)), datetools.parse_date_range('2018-09-14..2018-09-15'))
def test_trailingDotdots(self): self.assertEqual( datetools.DateRange(datetime.date(2018, 9, 14), None), datetools.parse_date_range('2018-09-14..'))
def test_leadingDotdots(self): self.assertEqual( datetools.DateRange(None, datetime.date(2018, 9, 14)), datetools.parse_date_range('..2018-09-14'))
def test_dates_after_date(self): options = pecuniacli._parse_options(['tags', '--dates=2018-09-14..']) self.assertEqual( datetools.DateSequence([ datetools.DateRange(datetime.date(2018, 9, 14), None), ]), options.dates)