1 # This file is part of lyx2lyx
2 # Copyright (C) 2018 The LyX team
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18 "This modules tests the auxiliary functions for lyx2lyx."
20 from lyx2lyx_tools import *
25 class TestParserTools(unittest.TestCase):
26 def test_put_cmd_in_ert(self):
31 "\\begin_layout Plain Layout",
45 ert_open[1] = "status open"
47 "\\begin_layout Standard",
51 "\\begin_layout Plain Layout",
68 self.assertEqual(put_cmd_in_ert("\\texttt{Grüße}"), ert)
69 self.assertEqual(put_cmd_in_ert(["\\texttt{Grüße}"]), ert)
70 self.assertEqual(put_cmd_in_ert("\\texttt{Grüße}", is_open=True), ert_open)
71 self.assertEqual(put_cmd_in_ert("\\texttt{Grüße}", as_paragraph=True), ert_paragraph)
73 def test_latex_length(self):
74 self.assertEqual(latex_length("-30.5col%"), (True, "-0.305\\columnwidth"))
75 self.assertEqual(latex_length("35baselineskip%"), (True, "0.35\\baselineskip"))
76 self.assertEqual(latex_length("11em"), (False, "11em"))
77 self.assertEqual(latex_length("-0.4pt"), (False, "-0.4pt"))
80 if __name__ == "__main__":