def testProtectedCallWithInstanceCreatedOnCpp(self): '''Calls a non-virtual protected method on an instance created in C++.''' p = ProtectedNonPolymorphic.create() self.assertEqual(p.publicName(), p.protectedName()) a0, a1 = 1, 2 self.assertEqual(p.protectedSum(a0, a1), a0 + a1)
def testProtectedCall(self): '''Calls a non-virtual protected method.''' p = ProtectedNonPolymorphic('NonPoly') self.assertEqual(p.publicName(), p.protectedName()) a0, a1 = 1, 2 self.assertEqual(p.protectedSum(a0, a1), a0 + a1)
def testModifiedProtectedCall(self): '''Calls a non-virtual protected method modified with code injection.''' p = ProtectedNonPolymorphic('NonPoly') self.assertEqual(p.dataTypeName(), 'integer') self.assertEqual(p.dataTypeName(1), 'integer') self.assertEqual(p.dataTypeName(Point(1, 2)), 'pointer')