コード例 #1
0
 def test_generate_intervals_filled(self):
     actual = _generate_intervals('2018-06-16', '2018-07-15', [
         {
             'from_date': '2018-06-16',
             'to_date': '2018-06-20'
         },
         {
             'from_date': '2018-06-21',
             'to_date': '2018-06-30'
         },
         {
             'from_date': '2018-07-01',
             'to_date': '2018-07-15'
         },
     ])
     expected = [
         {
             'from_date': '2018-06-16',
             'to_date': '2018-06-20'
         },
         {
             'from_date': '2018-06-21',
             'to_date': '2018-06-30'
         },
         {
             'from_date': '2018-07-01',
             'to_date': '2018-07-15'
         },
     ]
     self.assertEqual(actual, expected)
コード例 #2
0
 def test_generate_intervals_empty(self):
     actual = _generate_intervals('2018-06-16', '2018-07-15', [])
     expected = [{'from_date': '2018-06-16', 'to_date': '2018-07-15'}]
     self.assertEqual(actual, expected)