simple.py 550 B

12345678910111213141516171819202122232425262728293031323334
  1. """Simple example using doctests.
  2. This file just contains doctests both using plain python and IPython prompts.
  3. All tests should be loaded by nose.
  4. """
  5. from __future__ import print_function
  6. def pyfunc():
  7. """Some pure python tests...
  8. >>> pyfunc()
  9. 'pyfunc'
  10. >>> import os
  11. >>> 2+3
  12. 5
  13. >>> for i in range(3):
  14. ... print(i, end=' ')
  15. ... print(i+1, end=' ')
  16. ...
  17. 0 1 1 2 2 3
  18. """
  19. return 'pyfunc'
  20. def ipyfunc2():
  21. """Some pure python tests...
  22. >>> 1+1
  23. 2
  24. """
  25. return 'pyfunc2'