Coverage for tests/testMethodRegistry.py : 53%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
lsst.utils.tests.init()
return self._methodRegistry[key](self)
def _a_method(self): return 'a'
def _b_method(self): return 'b'
def _c_method(self): return 'c'
def _d_method(self): return 'd'
""" Test that the register_class and register_method decorators behave appropriately and preserve inheritance. """
aa = ClassA() self.assertEqual(aa.call('a'), 'a')
# below, we test to make sure that methods which # should not be in ClassA's _methodRegistry are not # spuriously added to the registry self.assertRaises(KeyError, aa.call, 'b') self.assertRaises(KeyError, aa.call, 'c') self.assertRaises(KeyError, aa.call, 'd')
bb = ClassB() self.assertEqual(bb.call('a'), 'a') self.assertEqual(bb.call('b'), 'b') self.assertRaises(KeyError, bb.call, 'c') self.assertRaises(KeyError, bb.call, 'd')
cc = ClassC() self.assertEqual(cc.call('a'), 'a') self.assertEqual(cc.call('b'), 'b') self.assertEqual(cc.call('c'), 'c') self.assertRaises(KeyError, cc.call, 'd')
dd = ClassD() self.assertEqual(dd.call('a'), 'a') self.assertEqual(dd.call('d'), 'd') self.assertRaises(KeyError, dd.call, 'b') self.assertRaises(KeyError, dd.call, 'c')
lsst.utils.tests.init() unittest.main() |