test.py 2.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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. def функция
  12. class Класс
  13. # Builtin objects.
  14. True False Ellipsis None NotImplemented
  15. # Builtin function and types.
  16. __import__ abs all any apply basestring bool buffer callable chr classmethod
  17. cmp coerce compile complex delattr dict dir divmod enumerate eval execfile file
  18. filter float frozenset getattr globals hasattr hash help hex id input int
  19. intern isinstance issubclass iter len list locals long map max min object oct
  20. open ord pow property range raw_input reduce reload repr reversed round set
  21. setattr slice sorted staticmethod str sum super tuple type unichr unicode vars
  22. xrange zip
  23. # Builtin exceptions and warnings.
  24. BaseException Exception StandardError ArithmeticError LookupError
  25. EnvironmentError
  26. AssertionError AttributeError EOFError FloatingPointError GeneratorExit IOError
  27. ImportError IndexError KeyError KeyboardInterrupt MemoryError NameError
  28. NotImplementedError OSError OverflowError ReferenceError RuntimeError
  29. StopIteration SyntaxError IndentationError TabError SystemError SystemExit
  30. TypeError UnboundLocalError UnicodeError UnicodeEncodeError UnicodeDecodeError
  31. UnicodeTranslateError ValueError WindowsError ZeroDivisionError
  32. Warning UserWarning DeprecationWarning PendingDepricationWarning SyntaxWarning
  33. RuntimeWarning FutureWarning OverflowWarning ImportWarning UnicodeWarning
  34. # Decorators.
  35. @ decoratorname
  36. @ object.__init__(arg1, arg2)
  37. # Numbers
  38. 0 1 2 9 10 0x1f .3 12.34 0j 0j 34.2E-3 0b10 0o77
  39. # Erroneous numbers
  40. 077 100L 0xfffffffL 0L 08 0xk 0x 0b102 0o78
  41. # Strings
  42. " test " ' test '
  43. """
  44. test
  45. """
  46. '''
  47. test
  48. '''
  49. " \a\b\c\"\'\n\r \x34\077 \08 \xag"
  50. r" \" \' "
  51. "testтест"
  52. b"test"
  53. b"тестtest"
  54. # Formattings
  55. " %f "
  56. "{0.name!r:b} {0[n]} {name!s: } {{test}} {{}}"
  57. "${test} ${test ${test}aname $$$ $test+nope"
  58. # Doctests.
  59. """
  60. Test:
  61. >>> a = 5
  62. >>> a
  63. 5
  64. Test
  65. """
  66. '''
  67. Test:
  68. >>> a = 5
  69. >>> a
  70. 5
  71. Test
  72. '''
  73. # Erroneous symbols or bad variable names.
  74. $ ? 6xav
  75. && || ===
  76. # Indentation errors.
  77. break
  78. # Trailing space errors.
  79. break
  80. """
  81. test
  82. """