Beispiel #1
0
 def test_generate_intervals_monthly_labels(self):
     actual = list(
         pluck(
             'label',
             generate_intervals('Monthly', '2012-12-12', '2013-04-19')
         )
     )
     expected = ['Dec 12', 'Jan 13', 'Feb 13', 'Mar 13', 'Apr 13']
     self.assertEqual(actual, expected)
Beispiel #2
0
 def test_generate_intervals_monthly_start_dates(self):
     actual = list(
         pluck(
             'start_date',
             generate_intervals('Monthly', '2012-12-12', '2013-01-19')
         )
     )
     expected = [getdate('2012-12-01'), getdate('2013-01-01')]
     self.assertEqual(actual, expected)
Beispiel #3
0
 def test_generate_intervals_weekly_labels(self):
     actual = list(
         pluck(
             'label',
             generate_intervals('Weekly', '2012-08-19', '2012-08-24')
         )
     )
     expected = ['2012-08-13', '2012-08-20']
     self.assertEqual(actual, expected)
Beispiel #4
0
 def test_generate_intervals_monthly_keys(self):
     actual = list(
         pluck(
             'key',
             generate_intervals('Monthly', '2012-12-12', '2013-03-19')
         )
     )
     expected = ['12M12', '13M01', '13M02', '13M03']
     self.assertEqual(actual, expected)
Beispiel #5
0
 def test_generate_intervals_weekly_end_dates(self):
     actual = list(
         pluck(
             'end_date',
             generate_intervals('Weekly', '2012-08-19', '2012-08-24')
         )
     )
     expected = [getdate('2012-08-19'), getdate('2012-08-26')]
     self.assertEqual(actual, expected)
Beispiel #6
0
 def test_generate_intervals_yearly_end_dates(self):
     actual = list(
         pluck(
             'end_date',
             generate_intervals('Yearly', '2012-12-12', '2013-01-19')
         )
     )
     expected = [getdate('2012-12-31'), getdate('2013-12-31')]
     self.assertEqual(actual, expected)
Beispiel #7
0
 def test_generate_intervals_weekly_keys(self):
     actual = list(
         pluck(
             'key',
             generate_intervals('Weekly', '2012-08-19', '2012-09-12')
         )
     )
     expected = ['12W33', '12W34', '12W35', '12W36', '12W37']
     self.assertEqual(actual, expected)
Beispiel #8
0
 def test_generate_intervals_yearly_labels(self):
     actual = list(
         pluck(
             'label',
             generate_intervals('Yearly', '2012-12-12', '2013-04-19')
         )
     )
     expected = ['2012', '2013']
     self.assertEqual(actual, expected)
Beispiel #9
0
 def test_generate_intervals_yearly_keys(self):
     actual = list(
         pluck(
             'key',
             generate_intervals('Yearly', '2012-12-12', '2013-03-19')
         )
     )
     expected = ['12Y', '13Y']
     self.assertEqual(actual, expected)
Beispiel #10
0
 def test_generate_intervals_monthly(self):
     actual = len(
         generate_intervals('Monthly', '2012-08-12', '2012-12-12')
     )
     expected = 5
     self.assertEqual(actual, expected)
Beispiel #11
0
 def test_generate_intervals_weekly(self):
     actual = len(
         generate_intervals('Weekly', '2012-08-19', '2012-09-12')
     )
     expected = 5
     self.assertEqual(actual, expected)
Beispiel #12
0
 def test_generate_intervals(self):
     actual = generate_intervals(None, '2012-12-12', '2012-12-12')
     expected = []
     self.assertEqual(actual, expected)
Beispiel #13
0
 def test_generate_intervals_yearly(self):
     actual = len(
         generate_intervals('Yearly', '2012-08-12', '2012-12-12')
     )
     expected = 1
     self.assertEqual(actual, expected)