##// END OF EJS Templates
Revert PR #5388...
Revert PR #5388 We realised that #5388 introduces a different problem of about the same magnitude as the one it fixes (both are quite minor). A proper fix would be too invasive this close to release, and after discussion, we decided it was better to leave the same problem that has been in previous releases.

File last commit:

r13593:544353be
r15886:7bba2551
Show More
test_latex.py
43 lines | 1.5 KiB | text/x-python | PythonLexer
"""
Module with tests for Latex
"""
#-----------------------------------------------------------------------------
# Copyright (c) 2013, the IPython Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file COPYING.txt, distributed with this software.
#-----------------------------------------------------------------------------
#-----------------------------------------------------------------------------
# Imports
#-----------------------------------------------------------------------------
from ...tests.base import TestsBase
from ..latex import escape_latex
#-----------------------------------------------------------------------------
# Class
#-----------------------------------------------------------------------------
class TestLatex(TestsBase):
def test_escape_latex(self):
"""escape_latex test"""
tests = [
(r'How are \you doing today?', r'How are \textbackslash{}you doing today?'),
(r'\escapechar=`\A\catcode`\|=0 |string|foo', r'\textbackslash{}escapechar=`\textbackslash{}A\textbackslash{}catcode`\textbackslash{}|=0 |string|foo'),
(r'# $ % & ~ _ ^ \ { }', r'\# \$ \% \& \textasciitilde{} \_ \^{} \textbackslash{} \{ \}'),
('...', r'\ldots'),
('','')]
for test in tests:
self._try_escape_latex(test[0], test[1])
def _try_escape_latex(self, test, result):
"""Try to remove latex from string"""
self.assertEqual(escape_latex(test), result)