test_example.txt 730 B

123456789101112131415161718192021222324
  1. =====================================
  2. Tests in example form - pure python
  3. =====================================
  4. This file contains doctest examples embedded as code blocks, using normal
  5. Python prompts. See the accompanying file for similar examples using IPython
  6. prompts (you can't mix both types within one file). The following will be run
  7. as a test::
  8. >>> 1+1
  9. 2
  10. >>> print ("hello")
  11. hello
  12. More than one example works::
  13. >>> s="Hello World"
  14. >>> s.upper()
  15. 'HELLO WORLD'
  16. but you should note that the *entire* test file is considered to be a single
  17. test. Individual code blocks that fail are printed separately as ``example
  18. failures``, but the whole file is still counted and reported as one test.