Skip to content

Commit

Permalink
added test_cells_with_symbol() : find source lines with symbol in a g…
Browse files Browse the repository at this point in the history
…iven file name
  • Loading branch information
kangwonlee committed Dec 24, 2017
1 parent 5a1d09d commit 31fe95a
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test_nbutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,18 @@ def test_has_symbol(self):

self.assertSequenceEqual(expected, result)

def test_cells_with_symbol(self):
result = nbutils.symbol_lines_in_file(self.input_file_name)

# compare with an expected list
expected = [(8, [(0, "L_AB_m = sy.symbols('L_AB_m', real=True, nonnegative=True)")]),
(10, [(0, "w0_N_m = sy.symbols('w0_N_m', real=True)")]),
(12, [(0, "E_Pa, I_m4 = sy.symbols('E_Pa, I_m4', positive=True)")]),
(14, [(0, "x_m = sy.symbols('x_m', nonnegative=True)")]),
(16, [(0, "R_A_N, M_A_Nm, R_B_N = sy.symbols('R_A_N, M_A_Nm, R_B_N', real=True)")])]

self.assertSequenceEqual(expected, result)

def test_replace_symbol(self):
file = nbutils.read_file(self.input_file_name)
cells = file['cells']
Expand Down

0 comments on commit 31fe95a

Please sign in to comment.