raw_ctor.py 781 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  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. >>> 'importing'
  6. 'importing'
  7. >>> from raw_ctor_ext import *
  8. >>> 'imported'
  9. 'imported'
  10. >>> import sys
  11. >>> sys.stdout.flush()
  12. >>> f = Foo(1, 2, 'a', bar = 3, baz = 4)
  13. >>> f.args
  14. (1, 2, 'a')
  15. >>> sorted(f.kw.items())
  16. [('bar', 3), ('baz', 4)]
  17. """
  18. def run(args = None):
  19. import sys
  20. import doctest
  21. if args is not None:
  22. sys.argv = args
  23. return doctest.testmod(sys.modules.get(__name__))
  24. if __name__ == '__main__':
  25. print("running...")
  26. import sys
  27. status = run()[0]
  28. if (status == 0): print("Done.")
  29. sys.exit(status)