Ignore:
Timestamp:
Mar 19, 2014, 11:31:01 PM (11 years ago)
Author:
dmik
Message:

python: Merge vendor 2.7.6 to trunk.

Location:
python/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • python/trunk

  • python/trunk/Lib/test/test_tokenize.py

    r2 r391  
    5757    ...
    5858
    59 There are some standard formattig practises that are easy to get right.
     59There are some standard formatting practices that are easy to get right.
    6060
    6161    >>> roundtrip("if x == 1:\\n"
     
    279279    STRING     'UR"ABC"'     (1, 34) (1, 41)
    280280
     281    >>> dump_tokens("b'abc' + B'abc'")
     282    STRING     "b'abc'"      (1, 0) (1, 6)
     283    OP         '+'           (1, 7) (1, 8)
     284    STRING     "B'abc'"      (1, 9) (1, 15)
     285    >>> dump_tokens('b"abc" + B"abc"')
     286    STRING     'b"abc"'      (1, 0) (1, 6)
     287    OP         '+'           (1, 7) (1, 8)
     288    STRING     'B"abc"'      (1, 9) (1, 15)
     289    >>> dump_tokens("br'abc' + bR'abc' + Br'abc' + BR'abc'")
     290    STRING     "br'abc'"     (1, 0) (1, 7)
     291    OP         '+'           (1, 8) (1, 9)
     292    STRING     "bR'abc'"     (1, 10) (1, 17)
     293    OP         '+'           (1, 18) (1, 19)
     294    STRING     "Br'abc'"     (1, 20) (1, 27)
     295    OP         '+'           (1, 28) (1, 29)
     296    STRING     "BR'abc'"     (1, 30) (1, 37)
     297    >>> dump_tokens('br"abc" + bR"abc" + Br"abc" + BR"abc"')
     298    STRING     'br"abc"'     (1, 0) (1, 7)
     299    OP         '+'           (1, 8) (1, 9)
     300    STRING     'bR"abc"'     (1, 10) (1, 17)
     301    OP         '+'           (1, 18) (1, 19)
     302    STRING     'Br"abc"'     (1, 20) (1, 27)
     303    OP         '+'           (1, 28) (1, 29)
     304    STRING     'BR"abc"'     (1, 30) (1, 37)
     305
    281306Operators
    282307
     
    494519
    495520Test roundtrip on random python modules.
    496 pass the '-ucompiler' option to process the full directory.
     521pass the '-ucpu' option to process the full directory.
    497522
    498523    >>>
     
    500525    >>> testfiles = glob.glob(os.path.join(tempdir, "test*.py"))
    501526
    502     >>> if not test_support.is_resource_enabled("compiler"):
     527    >>> if not test_support.is_resource_enabled("cpu"):
    503528    ...     testfiles = random.sample(testfiles, 10)
    504529    ...
     
    509534    ... else: True
    510535    True
     536
     537Evil tabs
     538    >>> dump_tokens("def f():\\n\\tif x\\n        \\tpass")
     539    NAME       'def'         (1, 0) (1, 3)
     540    NAME       'f'           (1, 4) (1, 5)
     541    OP         '('           (1, 5) (1, 6)
     542    OP         ')'           (1, 6) (1, 7)
     543    OP         ':'           (1, 7) (1, 8)
     544    NEWLINE    '\\n'          (1, 8) (1, 9)
     545    INDENT     '\\t'          (2, 0) (2, 1)
     546    NAME       'if'          (2, 1) (2, 3)
     547    NAME       'x'           (2, 4) (2, 5)
     548    NEWLINE    '\\n'          (2, 5) (2, 6)
     549    INDENT     '        \\t'  (3, 0) (3, 9)
     550    NAME       'pass'        (3, 9) (3, 13)
     551    DEDENT     ''            (4, 0) (4, 0)
     552    DEDENT     ''            (4, 0) (4, 0)
     553
     554Pathological whitespace (http://bugs.python.org/issue16152)
     555    >>> dump_tokens("@          ")
     556    OP         '@'           (1, 0) (1, 1)
    511557"""
    512558
    513559
    514560from test import test_support
    515 from tokenize import (tokenize, untokenize, generate_tokens, NUMBER, NAME, OP,
     561from tokenize import (untokenize, generate_tokens, NUMBER, NAME, OP,
    516562                     STRING, ENDMARKER, tok_name)
    517563from StringIO import StringIO
Note: See TracChangeset for help on using the changeset viewer.