andreas_beyer.py 630 B

123456789101112131415161718192021222324
  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 andreas_beyer_ext import *
  6. >>> b=B()
  7. >>> a=b.get() # let b create an A
  8. >>> a2=b.get()
  9. >>> assert id(a) == id(a2)
  10. '''
  11. def run(args = None):
  12. import sys
  13. import doctest
  14. if args is not None:
  15. sys.argv = args
  16. return doctest.testmod(sys.modules.get(__name__))
  17. if __name__ == '__main__':
  18. print("running...")
  19. import sys
  20. status = run()[0]
  21. if (status == 0): print("Done.")
  22. sys.exit(status)