• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# 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>>> from class_ext import *
6
7Ensure sanity:
8
9    >>> x = X(42)
10    >>> x_function(x)
11    42
12
13Demonstrate extraction in the presence of metaclass changes:
14
15    >>> class MetaX(X.__class__):
16    ...     def __new__(cls, *args):
17    ...         return super(MetaX, cls).__new__(cls, *args)
18    >>> class XPlusMetatype(X):
19    ...     __metaclass__ = MetaX
20    >>> x = XPlusMetatype(42)
21    >>> x_function(x)
22    42
23
24
25'''
26
27def run(args = None):
28    import sys
29    import doctest
30
31    if args is not None:
32        sys.argv = args
33    return doctest.testmod(sys.modules.get(__name__))
34
35if __name__ == '__main__':
36    print("running...")
37    import sys
38    status = run()[0]
39    if (status == 0): print("Done.")
40    sys.exit(status)
41