diff --git a/test_symbol_converter.py b/test_symbol_converter.py index 61c1bb34..300ab755 100644 --- a/test_symbol_converter.py +++ b/test_symbol_converter.py @@ -79,7 +79,7 @@ def test_replace_symbol(self): self.assertSequenceEqual(expected, result) -class TestSymbolConverter(unittest.TestCase): +class MyLineConverterTesterBase(unittest.TestCase): def setUp(self): self.input_file_name = 'sample.ipynb' @@ -88,6 +88,12 @@ def setUp(self): self.file_processor = fu.FileProcessor(self.input_file_name, self.cp) + def check_process_line(self, source_line, expected): + result = self.cp.process_line(source_line) + self.assertEqual(expected, result) + + +class TestSymbolConverter(MyLineConverterTesterBase): def test_wrap_symbol_name(self): result = self.cp.wrap_symbol_name('L_AB_m') expected = 'L_{AB}_{m}' @@ -190,10 +196,6 @@ def test_process_line_11(self): self.check_process_line("L_AB = sy.Symbol('L_AB_m', real=True, nonnegative=True)", "L_AB = sy.Symbol('L_{AB}[m]', real=True, nonnegative=True)") - def check_process_line(self, source_line, expected): - result = self.cp.process_line(source_line) - self.assertEqual(expected, result) - def test_process_line_100(self): self.check_process_line("L_AB_m, L_AC_m = sy.symbols('L_AB_m, L_AC_m', real=True, nonnegative=True)", "L_AB_m, L_AC_m = sy.symbols('L_{AB}[m], L_{AC}[m]', real=True, nonnegative=True)")