예제 #1
0
 def testReimplementedProtectedCall(self):
     '''Calls a reimplemented virtual protected method from parent class.'''
     original_name = 'Poly'
     p = ExtendedProtectedPolymorphicDaughter(original_name)
     name = p.callProtectedName()
     self.assertTrue(p.protectedName_called)
     self.assertEqual(p.protectedName(), name)
     self.assertEqual(ProtectedPolymorphicDaughter.protectedName(p), original_name)
예제 #2
0
 def testReimplementedProtectedCall(self):
     '''Calls a reimplemented virtual protected method from parent class.'''
     original_name = 'Poly'
     p = ExtendedProtectedPolymorphicDaughter(original_name)
     name = p.callProtectedName()
     self.assert_(p.protectedName_called)
     self.assertEqual(p.protectedName(), name)
     self.assertEqual(ProtectedPolymorphicDaughter.protectedName(p), original_name)
예제 #3
0
 def protectedName(self):
     self.protectedName_called = True
     self._name = 'ExtendedDaughter' + ProtectedPolymorphicDaughter.protectedName(
         self)
     return self._name
예제 #4
0
 def __init__(self, name):
     self.protectedName_called = False
     ProtectedPolymorphicDaughter.__init__(self, name)
예제 #5
0
 def testProtectedCallWithInstanceCreatedOnCpp(self):
     '''Calls a virtual protected method from parent class on an instance created in C++.'''
     p = ProtectedPolymorphicDaughter.create()
     self.assertEqual(p.publicName(), p.protectedName())
     self.assertEqual(p.callProtectedName(), p.protectedName())
예제 #6
0
 def protectedName(self):
     self.protectedName_called = True
     self._name = 'ExtendedDaughter' + ProtectedPolymorphicDaughter.protectedName(self)
     return self._name
예제 #7
0
 def __init__(self, name):
     self.protectedName_called = False
     ProtectedPolymorphicDaughter.__init__(self, name)
예제 #8
0
 def testProtectedCallWithInstanceCreatedOnCpp(self):
     '''Calls a virtual protected method from parent class on an instance created in C++.'''
     p = ProtectedPolymorphicDaughter.create()
     self.assertEqual(p.publicName(), p.protectedName())
     self.assertEqual(p.callProtectedName(), p.protectedName())