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

Method testInheritance

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

Source from the content-addressed store, hash-verified

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