from . import BaseTestCase, IntegrationTestCase, doxygen_version, parse_version
def dot_version():
- return re.match(".*version (?P<version>\d+\.\d+\.\d+).*", subprocess.check_output(['dot', '-V'], stderr=subprocess.STDOUT).decode('utf-8').strip()).group('version')
+ return re.match(r'.*version (?P<version>\d+\.\d+\.\d+).*', subprocess.check_output(['dot', '-V'], stderr=subprocess.STDOUT).decode('utf-8').strip()).group('version')
class Typography(IntegrationTestCase):
def test(self):
super().__init__(*args, **kwargs)
# Actually generated from $ \frac{\tau}{2} $ tho
- self.tau_half_hash = sha1("""$ \pi $""".encode('utf-8')).digest()
+ self.tau_half_hash = sha1(r"""$ \pi $""".encode('utf-8')).digest()
self.tau_half = """<?xml version='1.0' encoding='UTF-8'?>
<!-- This file was generated by dvisvgm 2.6.3 -->
<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='5.847936pt' height='15.326665pt' viewBox='1.195514 -8.1387 4.678349 12.261332'>
</g>
</svg>"""
# Actually generated from \[ a^3 + b^3 \neq c^3 \] tho
- self.fermat_hash = sha1("""\[ a^2 + b^2 = c^2 \]""".encode('utf-8')).digest()
+ self.fermat_hash = sha1(r"""\[ a^2 + b^2 = c^2 \]""".encode('utf-8')).digest()
self.fermat = """<?xml version='1.0' encoding='UTF-8'?>
<!-- This file was generated by dvisvgm 2.6.3 -->
<svg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='75.028924pt' height='15.496355pt' viewBox='164.01086 -12.397084 60.023139 12.397084'>
# The file is the same expect for titles of the formulas. Replace them
# and then compare.
with open(os.path.join(self.path, 'html', 'math-uncached.html')) as f:
- actual_contents = f.read().strip().replace('a^3 + b^3 \\neq c^3', 'a^2 + b^2 = c^2').replace('\\frac{\\tau}{2}', '\pi')
+ actual_contents = f.read().strip().replace(r'a^3 + b^3 \neq c^3', 'a^2 + b^2 = c^2').replace(r'\frac{\tau}{2}', r'\pi')
self.assertEqual(actual_contents, expected_contents)
with open(os.path.join(self.path, 'xml/math.cache'), 'rb') as f:
math_cache_actual = pickle.load(f)
math_cache_expected = (0, 0, {
- sha1("$ \\frac{\\tau}{2} $".encode('utf-8')).digest():
+ sha1('$ \frac{\tau}{2} $'.encode('utf-8')).digest():
(0, 0.344841, self.tau_half),
- sha1("\\[ a^3 + b^3 \\neq c^3 \\]".encode('utf-8')).digest():
+ sha1(r'\[ a^3 + b^3 \neq c^3 \]'.encode('utf-8')).digest():
(0, 0.0, self.fermat)})
self.assertEqual(math_cache_actual, math_cache_expected)
from . import PelicanPluginTestCase, parse_version
def dot_version():
- return re.match(".*version (?P<version>\d+\.\d+\.\d+).*", subprocess.check_output(['dot', '-V'], stderr=subprocess.STDOUT).decode('utf-8').strip()).group('version')
+ return re.match(r'.*version (?P<version>\d+\.\d+\.\d+).*', subprocess.check_output(['dot', '-V'], stderr=subprocess.STDOUT).decode('utf-8').strip()).group('version')
class Dot(PelicanPluginTestCase):
def __init__(self, *args, **kwargs):