Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/test/register_ptr_test.py @ 29

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

updated boost from 1_33_1 to 1_34_1

File size: 758 bytes
Line 
1# Copyright David Abrahams 2004. Distributed under the Boost
2# Software License, Version 1.0. (See accompanying
3# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4import unittest
5from register_ptr import *
6
7class RegisterPtrTest(unittest.TestCase):
8
9    def testIt(self):
10
11        class B(A):
12            def f(self):
13                return 10
14
15        a = New()  # this must work
16        b = B()
17        self.assertEqual(Call(a), 0)                                   
18        self.assertEqual(Call(b), 10)                     
19        def fails():
20            Fail(A())
21        self.assertRaises(TypeError, fails)
22        self.assertEqual(Fail(a), 0) # ok, since a is held by shared_ptr
23
24if __name__ == '__main__':
25    unittest.main()
Note: See TracBrowser for help on using the repository browser.