wrapper_held_type.py 706 B

12345678910111213141516171819202122232425262728293031323334
  1. # Copyright David Abrahams 2005. 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 wrapper_held_type_ext import *
  6. >>> d = data()
  7. >>> print(d.id())
  8. 42
  9. >>> do_nothing( d )
  10. >>> print(d.id())
  11. 42
  12. >>> d = create_data()
  13. >>> print(d.id())
  14. 42
  15. >>> do_nothing( d )
  16. >>> print(d.id())
  17. 42
  18. '''
  19. def run(args = None):
  20. import sys
  21. import doctest
  22. if args is not None:
  23. sys.argv = args
  24. return doctest.testmod(sys.modules.get(__name__))
  25. if __name__ == '__main__':
  26. print("running...")
  27. import sys
  28. status = run()[0]
  29. if (status == 0): print("Done.")
  30. sys.exit(status)