test.py 3.0KB

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