MCPcopy Index your code
hub / github.com/python/cpython / test_subclass_must_override

Method test_subclass_must_override

Lib/test/datetimetester.py:186–198  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

184 self.assertRaises(NotImplementedError, useless.dst, dt)
185
186 def test_subclass_must_override(self):
187 class NotEnough(tzinfo):
188 def __init__(self, offset, name):
189 self.__offset = offset
190 self.__name = name
191 self.assertIsSubclass(NotEnough, tzinfo)
192 ne = NotEnough(3, "NotByALongShot")
193 self.assertIsInstance(ne, tzinfo)
194
195 dt = datetime.now()
196 self.assertRaises(NotImplementedError, ne.tzname, dt)
197 self.assertRaises(NotImplementedError, ne.utcoffset, dt)
198 self.assertRaises(NotImplementedError, ne.dst, dt)
199
200 def test_normal(self):
201 fo = FixedOffset(3, "Three")

Callers

nothing calls this directly

Calls 5

NotEnoughClass · 0.85
assertIsSubclassMethod · 0.80
assertIsInstanceMethod · 0.80
nowMethod · 0.80
assertRaisesMethod · 0.45

Tested by

no test coverage detected