1 # This file is part of lyx2lyx
2 # -*- coding: utf-8 -*-
3 # Copyright (C) 2018 The LyX team
5 # This program is free software; you can redistribute it and/or
6 # modify it under the terms of the GNU General Public License
7 # as published by the Free Software Foundation; either version 2
8 # of the License, or (at your option) any later version.
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program; if not, write to the Free Software
17 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 " This modules tests the auxiliary functions for lyx2lyx."
21 from lyx2lyx_tools import *
25 class TestParserTools(unittest.TestCase):
27 def test_put_cmd_in_ert(self):
28 ert = ['\\begin_inset ERT',
31 '\\begin_layout Plain Layout',
34 u'texttt{Gr\\backslash',
40 self.assertEqual(put_cmd_in_ert(u"\\texttt{Grüße}"), ert)
41 self.assertEqual(put_cmd_in_ert([u"\\texttt{Grüße}"]), ert)
43 def test_latex_length(self):
44 self.assertEqual(latex_length("-30.5col%"), (True, "-0.305\\columnwidth"))
45 self.assertEqual(latex_length("35baselineskip%"), (True, "0.35\\baselineskip"))
46 self.assertEqual(latex_length("11em"), (False, "11em"))
47 self.assertEqual(latex_length("-0.4pt"), (False, "-0.4pt"))
51 if __name__ == '__main__':