test.py 2.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. #! /usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # Above the run-comment and file encoding comment.
  4. # Comments.
  5. # TODO FIXME XXX
  6. # Keywords.
  7. with break continue del exec return pass print raise global assert lambda yield
  8. for while if elif else import from as try except finally and in is not or
  9. def functionname
  10. class classname
  11. # Builtin objects.
  12. True False Ellipsis None NotImplemented
  13. # Builtin function and types.
  14. __import__ abs all any apply basestring bool buffer callable chr classmethod
  15. cmp coerce compile complex delattr dict dir divmod enumerate eval execfile file
  16. filter float frozenset getattr globals hasattr hash help hex id input int
  17. intern isinstance issubclass iter len list locals long map max min object oct
  18. open ord pow property range raw_input reduce reload repr reversed round set
  19. setattr slice sorted staticmethod str sum super tuple type unichr unicode vars
  20. xrange zip
  21. # Builtin exceptions and warnings.
  22. BaseException Exception StandardError ArithmeticError LookupError
  23. EnvironmentError
  24. AssertionError AttributeError EOFError FloatingPointError GeneratorExit IOError
  25. ImportError IndexError KeyError KeyboardInterrupt MemoryError NameError
  26. NotImplementedError OSError OverflowError ReferenceError RuntimeError
  27. StopIteration SyntaxError IndentationError TabError SystemError SystemExit
  28. TypeError UnboundLocalError UnicodeError UnicodeEncodeError UnicodeDecodeError
  29. UnicodeTranslateError ValueError WindowsError ZeroDivisionError
  30. Warning UserWarning DeprecationWarning PendingDepricationWarning SyntaxWarning
  31. RuntimeWarning FutureWarning OverflowWarning ImportWarning UnicodeWarning
  32. # Decorators.
  33. @ decoratorname
  34. # Numbers
  35. 0 0x1f 077 .3 12.34 100L 0j 0j 34.2E-3 0b10 0o77 0xfffffffL
  36. # Erroneous numbers
  37. 08 0xk 0x 0b102 0o78
  38. # Strings
  39. " test " ' test '
  40. """
  41. test
  42. """
  43. '''
  44. test
  45. '''
  46. " \a\b\c\"\'\n\r \x34\077 \08 \xag"
  47. r" \" \' "
  48. # Formattings
  49. " %f "
  50. "{0.name!r:b} {0[n]} {name!s: }"
  51. "${test} ${test ${test}aname"
  52. # Doctests.
  53. """
  54. Test:
  55. >>> a = 5
  56. >>> a
  57. 5
  58. Test
  59. """
  60. '''
  61. Test:
  62. >>> a = 5
  63. >>> a
  64. 5
  65. Test
  66. '''
  67. # Erroneous symbols or bad variable names.
  68. $ ? 6xav
  69. && || ++ -- ===
  70. # Indentation errors.
  71. break
  72. # Trailing space errors.
  73. break
  74. """
  75. test
  76. """