Ejemplo n.º 1
0
 def test_all_days(self):
     month_lengths = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
     count = 1
     for month in range(1, 13):
         for day in range(1, month_lengths[month - 1] + 1):
             self.assertEqual(qc.day_in_year(month, day), count)
             count += 1
Ejemplo n.º 2
0
    def get_tindex(self, month, day):
        '''
        Get the time index of the input month and day
        
        :param month: month for which the time index is required
        :param day: day for which the time index is required
        :type month: integer
        :type day: integer
        :return: time index for specified month and day.
        :rtype: integer
        '''
        if self.n == 1:
            tindex = 0
        if self.n == 73:
            tindex = qc.which_pentad(month, day) - 1
        if self.n == 365:
            tindex = qc.day_in_year(month, day) - 1

        return tindex
Ejemplo n.º 3
0
 def test_jan31(self):
     self.assertEqual(qc.day_in_year(1, 31), 31)
Ejemplo n.º 4
0
 def test_pesky_leapyear(self):
     self.assertEqual(qc.day_in_year(2, 29), qc.day_in_year(3, 1))
Ejemplo n.º 5
0
 def test_dec31st(self):
     self.assertEqual(qc.day_in_year(12, 31), 365)
Ejemplo n.º 6
0
 def test_janfirst(self):
     self.assertEqual(qc.day_in_year(1, 1), 1)