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) 4''' 5>>> from implicit_ext import * 6>>> x_value(X(42)) 742 8>>> x_value(42) 942 10>>> x = make_x(X(42)) 11>>> x.value() 1242 13>>> try: make_x('fool') 14... except TypeError: pass 15... else: print('no error') 16 17>>> print(x_value.__doc__.splitlines()[1]) 18x_value( (X)arg1) -> int : 19 20>>> print(make_x.__doc__.splitlines()[1]) 21make_x( (object)arg1) -> X : 22 23>>> print(X.value.__doc__.splitlines()[1]) 24value( (X)arg1) -> int : 25 26>>> print(X.set.__doc__.splitlines()[1]) 27set( (X)arg1, (object)arg2) -> None : 28 29''' 30 31def run(args = None): 32 import sys 33 import doctest 34 35 if args is not None: 36 sys.argv = args 37 return doctest.testmod(sys.modules.get(__name__)) 38 39if __name__ == '__main__': 40 print("running...") 41 import sys 42 status = run()[0] 43 if (status == 0): print("Done.") 44 sys.exit(status) 45