当前位置: 首页>>代码示例>>Python>>正文


Python Lexer.build方法代码示例

本文整理汇总了Python中xonsh.lexer.Lexer.build方法的典型用法代码示例。如果您正苦于以下问题:Python Lexer.build方法的具体用法?Python Lexer.build怎么用?Python Lexer.build使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在xonsh.lexer.Lexer的用法示例。


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

示例1: Lexer

# 需要导入模块: from xonsh.lexer import Lexer [as 别名]
# 或者: from xonsh.lexer.Lexer import build [as 别名]
# -*- coding: utf-8 -*-
"""Tests the xonsh lexer."""
from __future__ import unicode_literals, print_function
import os

import nose
from nose.tools import assert_equal, assert_true, assert_false

from xonsh.lexer import Lexer
from xonsh.tools import subproc_toks, subexpr_from_unbalanced, is_int, \
    always_true, always_false, ensure_string, is_env_path, str_to_env_path, \
    env_path_to_str, escape_windows_title_string, is_bool, to_bool, bool_to_str, \
    ensure_int_or_slice, is_float, is_string, check_for_partial_string

LEXER = Lexer()
LEXER.build()

INDENT = '    '

def test_subproc_toks_x():
    exp = '$[x]'
    obs = subproc_toks('x', lexer=LEXER, returnline=True)
    assert_equal(exp, obs)

def test_subproc_toks_ls_l():
    exp = '$[ls -l]'
    obs = subproc_toks('ls -l', lexer=LEXER, returnline=True)
    assert_equal(exp, obs)

def test_subproc_toks_git():
    s = 'git commit -am "hello doc"'
开发者ID:gforsyth,项目名称:xonsh,代码行数:33,代码来源:test_tools.py


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