pytype_function.py 682 B

1234567891011121314151617181920212223242526272829303132
  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 pytype_function_ext import *
  6. >>> print(func.__doc__.splitlines()[1])
  7. func( (A)arg1) -> A :
  8. >>> print(func.__module__)
  9. pytype_function_ext
  10. >>> print(func.__name__)
  11. func
  12. """
  13. def run(args = None):
  14. import sys
  15. import doctest
  16. if args is not None:
  17. sys.argv = args
  18. return doctest.testmod(sys.modules.get(__name__))
  19. if __name__ == '__main__':
  20. print("running...")
  21. import sys
  22. status = run()[0]
  23. if (status == 0): print("Done.")
  24. sys.exit(status)