def test_constructor(self): assert((self.d + DateOffset(months=2)) == datetime(2008, 3, 2)) assert((self.d - DateOffset(months=2)) == datetime(2007, 11, 2)) assert((self.d + DateOffset(2)) == datetime(2008, 1, 4)) assert not DateOffset(2).isAnchored() assert DateOffset(1).isAnchored() d = datetime(2008, 1, 31) assert((d + DateOffset(months=1)) == datetime(2008, 2, 29))
def test_eq(self): offset1 = DateOffset(days=1) offset2 = DateOffset(days=365) self.assert_(offset1 != offset2) self.assert_(not (offset1 == offset2))
def test_copy(self): assert(DateOffset(months=2).copy() == DateOffset(months=2))
def test_mul(self): assert DateOffset(2) == 2 * DateOffset(1) assert DateOffset(2) == DateOffset(1) * 2
def test_repr(self): repr(DateOffset()) repr(DateOffset(2)) repr(2 * DateOffset()) repr(2 * DateOffset(months=2))