• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#! /usr/bin/env python
2# Copyright Ralf W. Grosse-Kunstleve 2006. Distributed under the Boost
3# Software License, Version 1.0. (See accompanying
4# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
5
6# Using the doctest module here to ensure that the results are as expected.
7r'''>>> from extending import *
8    >>> hi = hello('California')
9    >>> hi.greet()
10    'Hello from California'
11    >>> invite(hi)
12    'Hello from California! Please come soon!'
13    >>> hi.invite()
14    'Hello from California! Please come soon!'
15
16    >>> class wordy(hello):
17    ...     def greet(self):
18    ...         return hello.greet(self) + ', where the weather is fine'
19    ...
20    >>> hi2 = wordy('Florida')
21    >>> hi2.greet()
22    'Hello from Florida, where the weather is fine'
23    >>> invite(hi2)
24    'Hello from Florida! Please come soon!'
25'''
26
27def run(args = None):
28    if args is not None:
29        import sys
30        sys.argv = args
31    import doctest, test_extending
32    return doctest.testmod(test_extending, verbose=True)
33
34if __name__ == '__main__':
35    import sys
36    sys.exit(run()[0])
37
38