Skip to content

Commit

Permalink
added class MyLineConverterTesterBase(unittest.TestCase) as superclas…
Browse files Browse the repository at this point in the history
…s for TestSymbolConverter
  • Loading branch information
kangwonlee committed Dec 26, 2017
1 parent 01a1cfa commit 3a4c651
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions test_symbol_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand All @@ -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}'
Expand Down Expand Up @@ -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)")
Expand Down

0 comments on commit 3a4c651

Please sign in to comment.