mirror of
https://github.com/sphinx-doc/sphinx.git
synced 2025-02-25 18:55:22 -06:00
fixed test_markup test
This commit is contained in:
parent
bedbbe288e
commit
24f1d4c12d
@ -14,6 +14,7 @@ import re
|
||||
import time
|
||||
import errno
|
||||
import shutil
|
||||
import sys
|
||||
from os import path
|
||||
|
||||
# Errnos that we need.
|
||||
@ -124,7 +125,9 @@ no_fn_re = re.compile(r'[^a-zA-Z0-9_-]')
|
||||
def make_filename(string):
|
||||
return no_fn_re.sub('', string)
|
||||
|
||||
|
||||
def ustrftime(format, *args):
|
||||
# strftime for unicode strings
|
||||
return time.strftime(unicode(format).encode('utf-8'), *args).decode('utf-8')
|
||||
if sys.version_info < (3, 0):
|
||||
def ustrftime(format, *args):
|
||||
# strftime for unicode strings
|
||||
return time.strftime(unicode(format).encode('utf-8'), *args).decode('utf-8')
|
||||
else:
|
||||
ustrftime = time.strftime
|
||||
|
@ -10,6 +10,7 @@
|
||||
"""
|
||||
|
||||
import re
|
||||
import sys
|
||||
|
||||
from util import *
|
||||
|
||||
@ -20,6 +21,12 @@ from sphinx.util import texescape
|
||||
from sphinx.writers.html import HTMLWriter, SmartyPantsHTMLTranslator
|
||||
from sphinx.writers.latex import LaTeXWriter, LaTeXTranslator
|
||||
|
||||
if sys.version_info > (3, 0):
|
||||
def b(s):
|
||||
return s.encode('utf-8')
|
||||
else:
|
||||
b = str
|
||||
|
||||
def setup_module():
|
||||
global app, settings, parser
|
||||
texescape.init() # otherwise done by the latex builder
|
||||
@ -50,7 +57,7 @@ class ForgivingLaTeXTranslator(LaTeXTranslator, ForgivingTranslator):
|
||||
|
||||
|
||||
def verify_re(rst, html_expected, latex_expected):
|
||||
document = utils.new_document('test data', settings)
|
||||
document = utils.new_document(b('test data'), settings)
|
||||
document['file'] = 'dummy'
|
||||
parser.parse(rst, document)
|
||||
for msg in document.traverse(nodes.system_message):
|
||||
|
Loading…
Reference in New Issue
Block a user