Beispiel #1
0
    def test01(self):
        
        l = [str(m) for m in anyrange(Month(2003,10),Month(2004,02),1)]
        s=" ".join(l)
        #print s
        self.assertEqual(s,"10/2003 11/2003 12/2003 01/2004 02/2004")
        
        m0 = m = Month(2003,3)
        self.assertEqual(m,Month(2003,3))
        
        m += 1
        self.assertEqual(m,Month(2003,4))

        m2 = m+1
        self.assertEqual(m2,Month(2003,5))
        
        i = Month(2005,6) - Month(2003,6)
        self.assertEqual(i,24)
        
        i = Month(2005,6) - Month(2003,4)
        self.assertEqual(i,26)
        
        i = Month(2005,6) - Month(2003,7)
        self.assertEqual(i,23)
        
        i = Month(2005,6) - Month(2005,6)
        self.assertEqual(i,0)

        i = Month(2002,8) - Month(1994,1)
        self.assertEqual(i,103) # 103=8*12+7
        
        i = Month(2005,5) - Month(1994,1)
        self.assertEqual(i,136) # 136=11*12+4
def everyday(d1,d2):
    return anyrange(itod(d1),itod(d2),DAY)