MCPcopy Create free account
hub / github.com/dateutil/dateutil / testInheritance

Method testInheritance

tests/test_relativedelta.py:18–42  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

16 today = date(2003, 9, 17)
17
18 def testInheritance(self):
19 # Ensure that relativedelta is inheritance-friendly.
20 class rdChildClass(relativedelta):
21 pass
22
23 ccRD = rdChildClass(years=1, months=1, days=1, leapdays=1, weeks=1,
24 hours=1, minutes=1, seconds=1, microseconds=1)
25
26 rd = relativedelta(years=1, months=1, days=1, leapdays=1, weeks=1,
27 hours=1, minutes=1, seconds=1, microseconds=1)
28
29 self.assertEqual(type(ccRD + rd), type(ccRD),
30 msg='Addition does not inherit type.')
31
32 self.assertEqual(type(ccRD - rd), type(ccRD),
33 msg='Subtraction does not inherit type.')
34
35 self.assertEqual(type(-ccRD), type(ccRD),
36 msg='Negation does not inherit type.')
37
38 self.assertEqual(type(ccRD * 5.0), type(ccRD),
39 msg='Multiplication does not inherit type.')
40
41 self.assertEqual(type(ccRD / 5.0), type(ccRD),
42 msg='Division does not inherit type.')
43
44 def testMonthEndMonthBeginning(self):
45 self.assertEqual(relativedelta(datetime(2003, 1, 31, 23, 59, 59),

Callers

nothing calls this directly

Calls 2

relativedeltaClass · 0.90
rdChildClassClass · 0.85

Tested by

no test coverage detected