Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/python/example/quickstart/test_extending.py @ 44

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

updated boost from 1_33_1 to 1_34_1

File size: 1.1 KB
Line 
1# Copyright Ralf W. Grosse-Kunstleve 2006. 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)
4
5# Using the doctest module here to ensure that the results are as expected.
6r'''>>> from extending import *
7    >>> hi = hello('California')
8    >>> hi.greet()
9    'Hello from California'
10    >>> invite(hi)
11    'Hello from California! Please come soon!'
12    >>> hi.invite()
13    'Hello from California! Please come soon!'
14
15    >>> class wordy(hello):
16    ...     def greet(self):
17    ...         return hello.greet(self) + ', where the weather is fine'
18    ...
19    >>> hi2 = wordy('Florida')
20    >>> hi2.greet()
21    'Hello from Florida, where the weather is fine'
22    >>> invite(hi2)
23    'Hello from Florida! Please come soon!'
24'''
25
26def run(args = None):
27    if args is not None:
28        import sys
29        sys.argv = args
30    import doctest, test_extending
31    return doctest.testmod(test_extending, verbose=True)
32
33if __name__ == '__main__':
34    import sys
35    sys.exit(run()[0])
36
Note: See TracBrowser for help on using the repository browser.