本文整理汇总了Python中util.remove_unicode_literals函数的典型用法代码示例。如果您正苦于以下问题:Python remove_unicode_literals函数的具体用法?Python remove_unicode_literals怎么用?Python remove_unicode_literals使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了remove_unicode_literals函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_images
def test_images():
assert warning_emitted('images', 'image file not readable: foo.png')
assert warning_emitted('images', 'nonlocal image URI found: '
'http://www.python.org/logo.png')
tree = env.get_doctree('images')
app._warning.reset()
htmlbuilder = StandaloneHTMLBuilder(app)
htmlbuilder.imgpath = 'dummy'
htmlbuilder.post_process_images(tree)
image_uri_message = "no matching candidate for image URI u'foo.*'"
if PY3:
image_uri_message = remove_unicode_literals(image_uri_message)
assert image_uri_message in app._warning.content[-1]
assert set(htmlbuilder.images.keys()) == \
set(['subdir/img.png', 'img.png', 'subdir/simg.png', 'svgimg.svg'])
assert set(htmlbuilder.images.values()) == \
set(['img.png', 'img1.png', 'simg.png', 'svgimg.svg'])
app._warning.reset()
latexbuilder = LaTeXBuilder(app)
latexbuilder.post_process_images(tree)
assert image_uri_message in app._warning.content[-1]
assert set(latexbuilder.images.keys()) == \
set(['subdir/img.png', 'subdir/simg.png', 'img.png', 'img.pdf',
'svgimg.pdf'])
assert set(latexbuilder.images.values()) == \
set(['img.pdf', 'img.png', 'img1.png', 'simg.png', 'svgimg.pdf'])
开发者ID:lehmannro,项目名称:sphinx-mirror,代码行数:28,代码来源:test_environment.py
示例2: test_multibyte_parameters
def test_multibyte_parameters(make_app, apidoc):
outdir = apidoc.outdir
assert (outdir / 'conf.py').isfile()
assert (outdir / 'autodoc_fodder.rst').isfile()
assert (outdir / 'index.rst').isfile()
conf_py = (outdir / 'conf.py').text()
conf_py_ = remove_unicode_literals(conf_py)
assert u"project = 'プロジェクト名'" in conf_py_
assert u"author = '著者名'" in conf_py_
assert u"version = 'バージョン'" in conf_py_
assert u"release = 'リリース'" in conf_py_
app = make_app('text', srcdir=outdir)
app.build()
print(app._status.getvalue())
print(app._warning.getvalue())
开发者ID:nwf,项目名称:sphinx,代码行数:17,代码来源:test_apidoc.py
示例3: remove_unicode_literals
from sphinx.errors import SphinxError
from sphinx.writers.latex import LaTeXTranslator
from util import SkipTest, remove_unicode_literals, with_app, strip_escseq
from test_build_html import ENV_WARNINGS
LATEX_WARNINGS = ENV_WARNINGS + """\
%(root)s/markup.txt:\\d+: WARNING: unknown option: &option
%(root)s/footnote.txt:\\d+: WARNING: citation not found: missing
%(root)s/images.txt:\\d+: WARNING: no matching candidate for image URI u'foo.\\*'
%(root)s/markup.txt:\\d+: WARNING: Could not lex literal_block as "c". Highlighting skipped.
"""
if PY3:
LATEX_WARNINGS = remove_unicode_literals(LATEX_WARNINGS)
def run_latex(outdir):
"""Run pdflatex, xelatex, and lualatex in the outdir"""
cwd = os.getcwd()
os.chdir(outdir)
try:
latexes = ('pdflatex', 'xelatex', 'lualatex')
available_latexes = len(latexes)
for latex in latexes:
try:
os.mkdir(latex)
p = Popen([latex, '--interaction=nonstopmode',
'-output-directory=%s' % latex, 'SphinxTests.tex'],
stdout=PIPE, stderr=PIPE)
开发者ID:amazingCreate,项目名称:sphinx,代码行数:31,代码来源:test_build_latex.py
示例4: remove_unicode_literals
from sphinx.writers.texinfo import TexinfoTranslator
from util import SkipTest, remove_unicode_literals, with_app
from test_build_html import ENV_WARNINGS
TEXINFO_WARNINGS = ENV_WARNINGS + """\
%(root)s/markup.txt:158: WARNING: unknown option: &option
%(root)s/footnote.txt:60: WARNING: citation not found: missing
%(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.\\*'
%(root)s/images.txt:29: WARNING: no matching candidate for image URI u'svgimg.\\*'
"""
if PY3:
TEXINFO_WARNINGS = remove_unicode_literals(TEXINFO_WARNINGS)
@with_app('texinfo', freshenv=True) # use freshenv to check warnings
def test_texinfo(app, status, warning):
TexinfoTranslator.ignore_missing_images = True
app.builder.build_all()
texinfo_warnings = warning.getvalue().replace(os.sep, '/')
texinfo_warnings_exp = TEXINFO_WARNINGS % {
'root': re.escape(app.srcdir.replace(os.sep, '/'))}
assert re.match(texinfo_warnings_exp + '$', texinfo_warnings), \
'Warnings don\'t match:\n' + \
'--- Expected (regex):\n' + texinfo_warnings_exp + \
'--- Got:\n' + texinfo_warnings
# now, try to run makeinfo over it
cwd = os.getcwd()
开发者ID:QuLogic,项目名称:sphinx,代码行数:30,代码来源:test_build_texinfo.py
示例5: remove_unicode_literals
:encoding: option\\n?
%(root)s/includes.txt:4: WARNING: download file not readable: .*?nonexisting.png
%(root)s/markup.txt:\\d+: WARNING: Malformed :option: u'Python c option', does \
not contain option marker - or -- or /
"""
HTML_WARNINGS = ENV_WARNINGS + """\
%(root)s/images.txt:20: WARNING: no matching candidate for image URI u'foo.\\*'
None:\\d+: WARNING: citation not found: missing
%(root)s/markup.txt:: WARNING: invalid single index entry u''
%(root)s/markup.txt:: WARNING: invalid pair index entry u''
%(root)s/markup.txt:: WARNING: invalid pair index entry u'keyword; '
"""
if PY3:
ENV_WARNINGS = remove_unicode_literals(ENV_WARNINGS)
HTML_WARNINGS = remove_unicode_literals(HTML_WARNINGS)
def tail_check(check):
rex = re.compile(check)
def checker(nodes):
for node in nodes:
if node.tail and rex.search(node.tail):
return True
assert False, '%r not found in tail of any nodes %s' % (check, nodes)
return checker
HTML_XPATH = {
'images.html': [
开发者ID:zsiddiqui2,项目名称:sphinxGit,代码行数:31,代码来源:test_build_html.py
注:本文中的util.remove_unicode_literals函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论