injected.py 625 B

12345678910111213141516171819202122232425262728
  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 injected_ext import *
  6. >>> X(3,5).value() - (3+5)
  7. 0
  8. >>> X(a=3,b=5,c=7).value() - (3*5*7)
  9. 0
  10. >>> X().value()
  11. 1000
  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)