• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python test_utils.parse_multi函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中test_utils.parse_multi函数的典型用法代码示例。如果您正苦于以下问题:Python parse_multi函数的具体用法?Python parse_multi怎么用?Python parse_multi使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了parse_multi函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: test_if_stmt

def test_if_stmt():
    "if a: pass"
    parse_multi([
           ('IF', 'if', [], [('SPACE', ' ')]),
           ('NAME', 'a'),
           ('COLON', ':'),
           ('PASS', 'pass'),
           ('ENDL', '\n'),
          ],
          [{
            "type": "ifelseblock",
            "value": [{
              "type": "if",
              "first_formatting": [{"type": "space", "value": " "}],
              "second_formatting": [],
              "third_formatting": [],
              "test": {
                  "type": "name",
                  "value": "a",
              },
              "value": [{
                  "type": "pass",
              },{
                 "formatting": [],
                 "indent": "",
                 "type": "endl",
                 "value": "\n"
              }],
             }],
          }])
开发者ID:titouanc,项目名称:baron,代码行数:30,代码来源:test_grammator_control_structures.py


示例2: test_file_input_simple_stmt_two_items_semicolon

def test_file_input_simple_stmt_two_items_semicolon():
    """
    a;a
    """
    parse_multi([
           ('NAME', 'a'), ('SEMICOLON', ';'), ('NAME', 'a'), ('ENDL', '\n'),
        ],[
           { "type": "name", "value": 'a', },
           {
            "type": "semicolon",
            "value": ";",
            "first_formatting": [],
            "second_formatting": [],
           },
           {"type": "name", "value": 'a'},
           { "type": "endl", "value": "\n", "formatting": [], "indent": "", },
          ])
    parse_multi([
           ('NAME', 'a'), ('SEMICOLON', ';'), ('NAME', 'a'), ('ENDL', '\n'),
        ],[
           {"type": "name", "value": 'a'},
           {
            "type": "semicolon",
            "value": ";",
            "first_formatting": [],
            "second_formatting": [],
           },
           { "type": "name", "value": 'a', },
           { "type": "endl", "value": "\n", "formatting": [], "indent": "", },
          ])
开发者ID:titouanc,项目名称:baron,代码行数:30,代码来源:test_grammator.py


示例3: test_funcdef_stmt_one_parameter_comma_default_indent

def test_funcdef_stmt_one_parameter_comma_default_indent():
    """
    def a ( x=1 , ) :
        pass
    """
    parse_multi([
             ('DEF', 'def', [], [('SPACE', ' ')]),
             ('NAME', 'a'),
             ('LEFT_PARENTHESIS', '(', [('SPACE', ' ')], [('SPACE', ' ')]),
             ('NAME', 'x'),
             ('EQUAL', '='),
             ('INT', '1'),
             ('COMMA', ',', [('SPACE', ' ')], [('SPACE', ' ')]),
             ('RIGHT_PARENTHESIS', ')', [('SPACE', ' ')]),
             ('COLON', ':', [('SPACE', ' ')]),
             ('ENDL', '\n', [], [('SPACE', '    ')]),
             ('INDENT', ''),
             ('PASS', 'pass'),
             ('ENDL', '\n'),
             ('DEDENT', ''),
          ],
          [{
            "type": "funcdef",
            "decorators": [],
            "name": "a",
            "first_formatting": [{"type": "space", "value": " "}],
            "second_formatting": [{"type": "space", "value": " "}],
            "third_formatting": [{"type": "space", "value": " "}],
            "forth_formatting": [{"type": "space", "value": " "}],
            "fith_formatting": [{"type": "space", "value": " "}],
            "sixth_formatting": [],
            "arguments": [{
                "type": "argument",
                "first_formatting": [],
                "second_formatting": [],
                "name": "x",
                "value": {
                    "type": "int",
                    "value": "1",
                    "section": "number",
                },
            },{
                "type": "comma",
                "first_formatting": [{"type": "space", "value": " "}],
                "second_formatting": [{"type": "space", "value": " "}],
            }],
            "value": [{
               "type": "endl",
               "value": "\n",
               "formatting": [],
               "indent": "    "
            },{
                "type": "pass",
            },{
               "formatting": [],
               "indent": "",
               "type": "endl",
               "value": "\n"
            }],
          }])
开发者ID:titouanc,项目名称:baron,代码行数:60,代码来源:test_grammator.py


示例4: test_with_a

def test_with_a():
    """
    with a: pass
    """
    parse_multi([
             ('WITH', 'with', [], [('SPACE', ' ')]),
             ('NAME', 'a'),
             ('COLON', ':', [], [('SPACE', ' ')]),
             ('PASS', 'pass'),
             ('ENDL', '\n'),
          ],
          [{
            "first_formatting": [{"type": "space", "value": " "}],
            "second_formatting": [],
            "third_formatting": [{"type": "space", "value": " "}],
            "type": "with",
            "contexts": [{
                "type": "with_context_item",
                "value": {
                    "type": "name",
                    "value": "a",
                },
                "first_formatting": [],
                "second_formatting": [],
                "as": {},
            }],
            "value": [{
               "type": "pass",
            },{
               "formatting": [],
               "indent": "",
               "type": "endl",
               "value": "\n",
            }],
          }])
开发者ID:titouanc,项目名称:baron,代码行数:35,代码来源:test_grammator.py


示例5: test_file_input_one_item

def test_file_input_one_item():
    "a"
    parse_multi([
           ('NAME', 'a'), ('ENDL', '\n'),
        ],[
           { "type": "name", "value": 'a', },
           { "type": "endl", "value": "\n", "formatting": [], "indent": "", },
          ])
开发者ID:titouanc,项目名称:baron,代码行数:8,代码来源:test_grammator.py


示例6: test_file_input_simple_stmt_one_item_semicolon_space

def test_file_input_simple_stmt_one_item_semicolon_space():
    """
    a ;
    """
    parse_multi([
           ('NAME', 'a'), ('SEMICOLON', ';', [('SPACE', ' ')], [('SPACE', ' ')]), ('ENDL', '\n'),
        ],[
           { "type": "name", "value": 'a', },
           { "type": "semicolon", "value": ";", "first_formatting": [{"type": "space", "value": ' '}], "second_formatting": [{"type": "space", "value": ' '}], },
           { "type": "endl", "value": "\n", "formatting": [], "indent": "", },
          ])
开发者ID:titouanc,项目名称:baron,代码行数:11,代码来源:test_grammator.py


示例7: test_class_decorator

def test_class_decorator():
    """
    @a
    class b(): pass
    """
    parse_multi([
             ('AT', '@', [], []),
             ('NAME', 'a'),
             ('ENDL', '\n'),
             ('CLASS', 'class', [], [('SPACE', ' ')]),
             ('NAME', 'b'),
             ('LEFT_PARENTHESIS', '('),
             ('RIGHT_PARENTHESIS', ')'),
             ('COLON', ':', [], [('SPACE', ' ')]),
             ('PASS', 'pass'),
             ('ENDL', '\n'),
          ],
          [{
            "first_formatting": [{"type": "space", "value": " "}],
            "second_formatting": [],
            "third_formatting": [],
            "fith_formatting": [],
            "forth_formatting": [],
            "sixth_formatting": [{"type": "space", "value": " "}],
            "type": "class",
            "inherit_from": [],
            "parenthesis": True,
            "name": "b",
            "decorators": [{
                "type": "decorator",
                "call": {},
                "formatting": [],
                "value": {
                    "type": "dotted_name",
                    "value": [{
                    "type": "name",
                    "value": "a",
                    }],
                }
            },{
               "formatting": [],
               "indent": "",
               "type": "endl",
               "value": "\n",
            }],
            "value": [{
               "type": "pass",
            },{
               "formatting": [],
               "indent": "",
               "type": "endl",
               "value": "\n",
            }],
          }])
开发者ID:titouanc,项目名称:baron,代码行数:54,代码来源:test_grammator.py


示例8: test_decorator

def test_decorator():
    """
    @a
    def b(): pass
    """
    parse_multi([
             ('AT', '@', [], []),
             ('NAME', 'a'),
             ('ENDL', '\n'),
             ('DEF', 'def', [], [('SPACE', ' ')]),
             ('NAME', 'b'),
             ('LEFT_PARENTHESIS', '('),
             ('RIGHT_PARENTHESIS', ')'),
             ('COLON', ':', [], [('SPACE', ' ')]),
             ('PASS', 'pass'),
             ('ENDL', '\n'),
          ],
          [{
            "first_formatting": [{"type": "space", "value": " "}],
            "second_formatting": [],
            "third_formatting": [],
            "fith_formatting": [],
            "forth_formatting": [],
            "sixth_formatting": [{"type": "space", "value": " "}],
            "type": "funcdef",
            "arguments": [],
            "name": "b",
            "decorators": [{
                "type": "decorator",
                "formatting": [],
                "call": {},
                "value": {
                    "type": "dotted_name",
                    "value": [{
                    "type": "name",
                    "value": "a",
                    }],
                }
            },{
               "formatting": [],
               "indent": "",
               "type": "endl",
               "value": "\n",
            }],
            "value": [{
               "type": "pass",
            },{
               "formatting": [],
               "indent": "",
               "type": "endl",
               "value": "\n",
            }],
          }])
开发者ID:titouanc,项目名称:baron,代码行数:53,代码来源:test_grammator.py


示例9: test_funcdef_stmt_one_star_star_parameter_indent

def test_funcdef_stmt_one_star_star_parameter_indent():
    """
    def a (**b):
        pass
    """
    parse_multi([
             ('DEF', 'def', [], [('SPACE', ' ')]),
             ('NAME', 'a'),
             ('LEFT_PARENTHESIS', '('),
             ('DOUBLE_STAR', '**'),
             ('NAME', 'b'),
             ('RIGHT_PARENTHESIS', ')'),
             ('COLON', ':', [], [('SPACE', ' ')]),
             ('ENDL', '\n', [], [('SPACE', '    ')]),
             ('INDENT', ''),
             ('PASS', 'pass'),
             ('ENDL', '\n'),
             ('DEDENT', ''),
          ],
          [{
            "type": "funcdef",
            "name": "a",
            "decorators": [],
            "first_formatting": [{"type": "space", "value": " "}],
            "second_formatting": [],
            "third_formatting": [],
            "forth_formatting": [],
            "fith_formatting": [],
            "sixth_formatting": [{"type": "space", "value": " "}],
            "arguments": [{
                "type": "dict_argument",
                "formatting": [],
                "value": {
                    "value": "b",
                    "type": "name",
                }
            }],
            "value": [{
               "type": "endl",
               "formatting": [],
               "value": "\n",
               "indent": "    "
            },{
                "type": "pass",
            },{
               "formatting": [],
               "indent": "",
               "type": "endl",
               "value": "\n"
            }],
          }])
开发者ID:titouanc,项目名称:baron,代码行数:51,代码来源:test_grammator.py


示例10: test_fplist_alone

def test_fplist_alone():
    """
    def a((b)): pass
    """
    parse_multi([
            ('DEF', 'def', [], [('SPACE', ' ')]),
            ('NAME', 'a'),
            ('LEFT_PARENTHESIS', '('),
            ('LEFT_PARENTHESIS', '('),
            ('NAME', 'b'),
            ('RIGHT_PARENTHESIS', ')'),
            ('RIGHT_PARENTHESIS', ')'),
            ('COLON', ':', [], [('SPACE', ' ')]),
            ('PASS', 'pass'),
            ('ENDL', '\n'),
          ],
          [{
            "first_formatting": [{"type": "space", "value": " "}],
            "second_formatting": [],
            "third_formatting": [],
            "fith_formatting": [],
            "forth_formatting": [],
            "sixth_formatting": [{"type": "space", "value": " "}],
            "type": "funcdef",
            "arguments": [{
                "type": "associative_parenthesis",
                "first_formatting": [],
                "second_formatting": [],
                "third_formatting": [],
                "forth_formatting": [],
                "value": {
                    "value": {},
                    "type": "argument",
                    "first_formatting": [],
                    "second_formatting": [],
                    "name": "b",
                }
            }],
            "name": "a",
            "decorators": [],
            "value": [{
               "type": "pass",
            },{
               "formatting": [],
               "indent": "",
               "type": "endl",
               "value": "\n",
            }],
          }])
开发者ID:titouanc,项目名称:baron,代码行数:49,代码来源:test_grammator.py


示例11: test_for_stmt_indent

def test_for_stmt_indent():
    """
    for i in a:
        pass
    """
    parse_multi([
            ('FOR', 'for', [], [('SPACE', ' ')]),
            ('NAME', 'i'),
            ('IN', 'in', [('SPACE', ' ')], [('SPACE', ' ')]),
            ('NAME', 'a'),
            ('COLON', ':', [], [('SPACE', ' ')]),
            ('ENDL', '\n', [], [('SPACE', '    ')]),
            ('INDENT', ''),
            ('PASS', 'pass'),
            ('ENDL', '\n'),
            ('DEDENT', ''),
          ],
          [{
            "type": "for",
            "first_formatting": [{"type": "space", "value": " "}],
            "second_formatting": [{"type": "space", "value": " "}],
            "third_formatting": [{"type": "space", "value": " "}],
            "forth_formatting": [],
            "fith_formatting": [{"type": "space", "value": " "}],
            "else": {},
            "iterator": {
                "type": "name",
                "value": "i",
            },
            "target": {
                "type": "name",
                "value": "a",
            },
             "value": [{
                "type": "endl",
                "value": "\n",
                "formatting": [],
                "indent": "    "
             },{
                 "type": "pass",
             },{
                "indent": "",
                "formatting": [],
                "type": "endl",
                "value": "\n"
             }],
          }])
开发者ID:titouanc,项目名称:baron,代码行数:47,代码来源:test_grammator_control_structures.py


示例12: test_class_inherit

def test_class_inherit():
    """
    class A ( B ) :
        pass
    """
    parse_multi([
             ('CLASS', 'class', [], [('SPACE', ' ')]),
             ('NAME', 'A'),
             ('LEFT_PARENTHESIS', '(', [('SPACE', ' ')], [('SPACE', ' ')]),
             ('NAME', 'B'),
             ('RIGHT_PARENTHESIS', ')', [('SPACE', ' ')], [('SPACE', ' ')]),
             ('COLON', ':'),
             ('ENDL', '\n', [], [('SPACE', '    ')]),
             ('INDENT', ''),
             ('PASS', 'pass'),
             ('ENDL', '\n', [], []),
             ('DEDENT', ''),
          ],
          [{
            "type": "class",
            "name": "A",
            "decorators": [],
            "parenthesis": True,
            "first_formatting": [{"type": "space", "value": " "}],
            "second_formatting": [{"type": "space", "value": " "}],
            "third_formatting": [{"type": "space", "value": " "}],
            "forth_formatting": [{"type": "space", "value": " "}],
            "fith_formatting": [{"type": "space", "value": " "}],
            "sixth_formatting": [],
            "inherit_from": [{
                "type": "name",
                "value": "B"
            }],
            "value": [{
               "type": "endl",
               "value": "\n",
               "formatting": [],
               "indent": "    "
            },{
                "type": "pass",
            },{
               "formatting": [],
               "indent": "",
               "type": "endl",
               "value": "\n"
            }],
          }])
开发者ID:titouanc,项目名称:baron,代码行数:47,代码来源:test_grammator.py


示例13: test_comment

def test_comment():
    """
      # comment
    """
    parse_multi([
             ('COMMENT', '# comment', [('SPACE', '  ')]),
             ('ENDL', '\n'),
          ],
          [{
            "formatting": [{"type": "space", "value": "  "}],
            "type": "comment",
            "value": "# comment",
          },{
            "formatting": [],
            "indent": "",
            "type": "endl",
            "value": "\n",
          }])
开发者ID:titouanc,项目名称:baron,代码行数:18,代码来源:test_grammator.py


示例14: test_funcdef_stmt_indent

def test_funcdef_stmt_indent():
    """
    def a () :
        pass
    """
    parse_multi([
             ('DEF', 'def', [], [('SPACE', ' ')]),
             ('NAME', 'a'),
             ('LEFT_PARENTHESIS', '(', [('SPACE', ' ')]),
             ('RIGHT_PARENTHESIS', ')'),
             ('COLON', ':', [('SPACE', ' ')], [('SPACE', ' ')]),
             ('ENDL', '\n', [], [('SPACE', '    ')]),
             ('INDENT', ''),
             ('PASS', 'pass'),
             ('ENDL', '\n'),
             ('DEDENT', ''),
          ],
          [{
            "type": "funcdef",
            "name": "a",
            "decorators": [],
            "first_formatting": [{"type": "space", "value": " "}],
            "second_formatting": [{"type": "space", "value": " "}],
            "third_formatting": [],
            "fourth_formatting": [],
            "fifth_formatting": [{"type": "space", "value": " "}],
            "sixth_formatting": [{"type": "space", "value": " "}],
            "arguments": [],
            "value": [{
               "type": "endl",
               "value": "\n",
               "formatting": [],
               "indent": "    "
            },{
                "type": "pass",
            },{
               "type": "endl",
               "formatting": [],
               "indent": "",
               "value": "\n"
            }],
          }])
开发者ID:oksome,项目名称:baron,代码行数:42,代码来源:test_grammator.py


示例15: test_class_empty

def test_class_empty():
    """
    class A:
        pass
    """
    parse_multi([
             ('CLASS', 'class', [], [('SPACE', ' ')]),
             ('NAME', 'A'),
             ('COLON', ':'),
             ('ENDL', '\n', [], [('SPACE', '    ')]),
             ('INDENT', ''),
             ('PASS', 'pass'),
             ('ENDL', '\n', [], []),
             ('DEDENT', ''),
          ],
          [{
            "type": "class",
            "name": "A",
            "decorators": [],
            "parenthesis": False,
            "first_formatting": [{"type": "space", "value": " "}],
            "second_formatting": [],
            "third_formatting": [],
            "fourth_formatting": [],
            "fifth_formatting": [],
            "sixth_formatting": [],
            "inherit_from": [],
            "value": [{
               "type": "endl",
               "formatting": [],
               "value": "\n",
               "indent": "    "
            },{
                "type": "pass",
            },{
               "formatting": [],
               "indent": "",
               "type": "endl",
               "value": "\n"
            }],
          }])
开发者ID:oksome,项目名称:baron,代码行数:41,代码来源:test_grammator.py


示例16: test_while_stmt_indent_third_formatting

def test_while_stmt_indent_third_formatting():
    """
    while a : 
        pass
    """
    parse_multi([
           ('WHILE', 'while', [], [('SPACE', ' ')]),
           ('NAME', 'a'),
           ('COLON', ':', [('SPACE', ' ')], [('SPACE', ' ')]),
           ('ENDL', '\n', [], [('SPACE', '    ')]),
           ('INDENT', ''),
           ('PASS', 'pass'),
           ('ENDL', '\n'),
           ('DEDENT', ''),
          ],
          [{
            "type": "while",
            "first_formatting": [{"type": "space", "value": " "}],
            "second_formatting": [{"type": "space", "value": " "}],
            "third_formatting": [{"type": "space", "value": " "}],
            "else": {},
            "test": {
                "type": "name",
                "value": "a",
            },
             "value": [{
                "type": "endl",
                "formatting": [],
                "value": "\n",
                "indent": "    "
             },{
                 "type": "pass",
             },{
                "formatting": [],
                "indent": "",
                "type": "endl",
                "value": "\n"
             }],
          }])
开发者ID:titouanc,项目名称:baron,代码行数:39,代码来源:test_grammator_control_structures.py


示例17: test_try_excepts_stmt_empty

def test_try_excepts_stmt_empty():
    """
    try :
        pass
    except:
        pass
    """
    parse_multi([
             ('TRY', 'try'),
             ('COLON', ':', [('SPACE', ' ')]),
             ('ENDL', '\n', [], [('SPACE', '    ')]),
             ('INDENT', ''),
             ('PASS', 'pass'),
             ('ENDL', '\n'),
             ('DEDENT', ''),
             ('EXCEPT', 'except', [], []),
             ('COLON', ':'),
             ('ENDL', '\n', [], [('SPACE', '    ')]),
             ('INDENT', ''),
             ('PASS', 'pass'),
             ('ENDL', '\n'),
             ('DEDENT', ''),
          ],
          [{
            "type": "try",
            "first_formatting": [{"type": "space", "value": " "}],
            "second_formatting": [],
            "else": {},
            "finally": {},
            "excepts": [{
               "type": "except",
               "first_formatting": [],
               "second_formatting": [],
               "third_formatting": [],
               "fourth_formatting": [],
               "fifth_formatting": [],
               "delimiteur": "",
               "target": {},
               "exception": {},
                "value": [{
                    "type": "endl",
                    "formatting": [],
                    "value": "\n",
                    "indent": "    "
                 },{
                     "type": "pass",
                 },{
                    "indent": "",
                    "formatting": [],
                    "type": "endl",
                    "value": "\n"
                 }]
            }],
            "value": [{
                "type": "endl",
                "formatting": [],
                "value": "\n",
                "indent": "    "
             },{
                 "type": "pass",
             },{
                "indent": "",
                "formatting": [],
                "type": "endl",
                "value": "\n"
             }],
          }])
开发者ID:oksome,项目名称:baron,代码行数:67,代码来源:test_grammator_control_structures.py


示例18: test_if_elif_elif_else_stmt_indent

def test_if_elif_elif_else_stmt_indent():
    """
    if a:
        pass
    elif b:
        pass
    elif c :
        pass
    else:
        pass
    """
    parse_multi([
           ('IF', 'if', [], [('SPACE', ' ')]),
           ('NAME', 'a'),
           ('COLON', ':'),
           ('ENDL', '\n', [], [('SPACE', '    ')]),
           ('INDENT', ''),
           ('PASS', 'pass'),
           ('ENDL', '\n'),
           ('DEDENT', ''),
           ('ELIF', 'elif', [], [('SPACE', ' ')]),
           ('NAME', 'b'),
           ('COLON', ':'),
           ('ENDL', '\n', [], [('SPACE', '    ')]),
           ('INDENT', ''),
           ('PASS', 'pass'),
           ('ENDL', '\n'),
           ('DEDENT', ''),
           ('ELIF', 'elif', [], [('SPACE', ' ')]),
           ('NAME', 'c'),
           ('COLON', ':', [('SPACE', ' ')]),
           ('ENDL', '\n', [], [('SPACE', '    ')]),
           ('INDENT', ''),
           ('PASS', 'pass'),
           ('ENDL', '\n'),
           ('DEDENT', ''),
           ('ELSE', 'else', [], [('SPACE', ' ')]),
           ('COLON', ':'),
           ('ENDL', '\n', [], [('SPACE', '    ')]),
           ('INDENT', ''),
           ('PASS', 'pass'),
           ('ENDL', '\n'),
           ('DEDENT', ''),
          ],
          [{
            "type": "ifelseblock",
            "value": [{
              "type": "if",
              "first_formatting": [{"type": "space", "value": " "}],
              "second_formatting": [],
              "third_formatting": [],
              "test": {
                  "type": "name",
                  "value": "a",
              },
              "value": [{
                 "type": "endl",
                 "formatting": [],
                 "value": "\n",
                 "indent": "    "
                },{
                 "type": "pass",
                },{
                 "formatting": [],
                 "indent": "",
                 "type": "endl",
                 "value": "\n"
                }],
            },{
              "type": "elif",
              "first_formatting": [{"type": "space", "value": " "}],
              "second_formatting": [],
              "third_formatting": [],
              "test": {
                  "type": "name",
                  "value": "b",
              },
              "value": [{
                 "type": "endl",
                 "value": "\n",
                 "formatting": [],
                 "indent": "    "
                },{
                 "type": "pass",
                },{
                 "type": "endl",
                 "value": "\n",
                 "formatting": [],
                 "indent": "",
                }],
            },{
              "type": "elif",
              "first_formatting": [{"type": "space", "value": " "}],
              "second_formatting": [{"type": "space", "value": " "}],
              "third_formatting": [],
              "test": {
                  "type": "name",
                  "value": "c",
              },
              "value": [{
#.........这里部分代码省略.........
开发者ID:titouanc,项目名称:baron,代码行数:101,代码来源:test_grammator_control_structures.py


示例19: test_file_input_empty

def test_file_input_empty():
    ""
    parse_multi([
        ],[
        ])
开发者ID:titouanc,项目名称:baron,代码行数:5,代码来源:test_grammator.py


示例20: test_try_finally_stmt_indent

def test_try_finally_stmt_indent():
    """
    try :
        pass
    finally :
        pass
    """
    parse_multi([
             ('TRY', 'try'),
             ('COLON', ':', [('SPACE', ' ')]),
             ('ENDL', '\n', [], [('SPACE', '    ')]),
             ('INDENT', ''),
             ('PASS', 'pass'),
             ('ENDL', '\n'),
             ('DEDENT', ''),
             ('FINALLY', 'finally'),
             ('COLON', ':', [('SPACE', ' ')]),
             ('ENDL', '\n', [], [('SPACE', '    ')]),
             ('INDENT', ''),
             ('PASS', 'pass'),
             ('ENDL', '\n'),
             ('DEDENT', ''),
          ],
          [{
            "type": "try",
            "first_formatting": [{"type": "space", "value": " "}],
            "second_formatting": [],
            "else": {},
            "finally": {
                "type": "finally",
                "first_formatting": [{"type": "space", "value": " "}],
                "second_formatting": [],
                "value": [{
                "type": "endl",
                "value": "\n",
                "formatting": [],
                "indent": "    "
                },{
                  "type": "pass",
                },{
                  "indent": "",
                  "formatting": [],
                  "type": "endl",
                  "value": "\n"
                }],
            },
            "excepts": [],
            "value": [{
                "type": "endl",
                "value": "\n",
                "formatting": [],
                "indent": "    "
             },{
                 "type": "pass",
             },{
                "indent": "",
                "formatting": [],
                "type": "endl",
                "value": "\n"
             }],
          }])
开发者ID:titouanc,项目名称:baron,代码行数:61,代码来源:test_grammator_control_structures.py



注:本文中的test_utils.parse_multi函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python test_utils.parse_simple函数代码示例发布时间:2022-05-27
下一篇:
Python test_utils.mock函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap