test.py 2.6KB

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