test.py 2.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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 0L
  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. u"test"
  49. b"test"
  50. # Formattings
  51. " %f "
  52. "{0.name!r:b} {0[n]} {name!s: } {{test}} {{}}"
  53. "${test} ${test ${test}aname $$$ $test+nope"
  54. # Doctests.
  55. """
  56. Test:
  57. >>> a = 5
  58. >>> a
  59. 5
  60. Test
  61. """
  62. '''
  63. Test:
  64. >>> a = 5
  65. >>> a
  66. 5
  67. Test
  68. '''
  69. # Erroneous symbols or bad variable names.
  70. $ ? 6xav
  71. && || ===
  72. # Indentation errors.
  73. break
  74. # Trailing space errors.
  75. break
  76. """
  77. test
  78. """