Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/pyste/tests/virtual2UT.py @ 47

Last change on this file since 47 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.2 KB
Line 
1# Copyright Bruno da Silva de Oliveira 2003. Use, modification and
2# distribution is subject to the Boost Software License, Version 1.0.
3# (See accompanying file LICENSE_1_0.txt or copy at
4# http:#www.boost.org/LICENSE_1_0.txt)
5
6import unittest
7from _virtual2 import *
8
9class Virtual2Test(unittest.TestCase):
10
11    def testIt(self):
12        a = A()
13        self.assertEqual(a.f1(), 10)
14        b = B()
15        self.assertEqual(b.f1(), 10)
16        self.assertEqual(b.f2(), 20)
17        self.assertEqual(call_fs(b), 30)
18        self.assertEqual(call_f(a), 0)
19        self.assertEqual(call_f(b), 1)
20        nb = b.make_new()
21        na = a.make_new()
22        self.assertEqual(na.f1(), 10)
23        self.assertEqual(nb.f1(), 10)
24        self.assertEqual(nb.f2(), 20)
25        self.assertEqual(call_fs(nb), 30)
26        self.assertEqual(call_f(na), 0)
27        self.assertEqual(call_f(nb), 1) 
28        class C(B):
29            def f1(self): return 1
30            def f2(self): return 2
31            def f(self): return 100
32
33        c = C()
34        self.assertEqual(call_fs(c), 3)
35        self.assertEqual(call_fs(c), 3)
36        self.assertEqual(call_f(c), 100)
37
38
39if __name__ == '__main__':
40    unittest.main() 
Note: See TracBrowser for help on using the repository browser.