Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/pyste/tests/inherit2UT.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: 944 bytes
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)
5import unittest
6from _inherit2 import *
7
8class InheritExampleTest(unittest.TestCase):
9
10    def testIt(self):
11        b = B()
12        d = D()
13       
14        self.assert_(issubclass(D, B))
15        b.x, b.y = 10, 5
16        self.assertEqual(b.getx(), 10)
17        self.assertEqual(b.gety(), 5)
18        d.x, d.y, d.z, d.w = 20, 15, 10, 5
19        self.assertEqual(d.getx(), 20)
20        self.assertEqual(d.gety(), 15) 
21        self.assertEqual(d.getz(), 10)
22        self.assertEqual(d.getw(), 5) 
23        self.assertEqual(b.foo(), 1)
24        self.assertEqual(b.foo(3), 3)
25
26        def wrong():
27            return b.getw()
28        self.assertRaises(AttributeError, wrong)
29
30if __name__ == '__main__':
31    unittest.main() 
Note: See TracBrowser for help on using the repository browser.