Skip to content

Commit

Permalink
started test_replace_symbol() : test cases for file level replace res…
Browse files Browse the repository at this point in the history
…ults
  • Loading branch information
kangwonlee committed Dec 24, 2017
1 parent b847d7d commit 5a1d09d
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test_nbutils.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,24 @@ def test_has_symbol(self):

self.assertSequenceEqual(expected, result)

def test_replace_symbol(self):
file = nbutils.read_file(self.input_file_name)
cells = file['cells']
result = []
for k, cell in enumerate(cells):
cell_result = nbutils.has_symbol(cell)
if cell_result:
result.append((k, cell_result))

# 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[m^{4}]', 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 _exec_notebook(path):
# http://nbconvert.readthedocs.io/en/latest/execute_api.html
Expand Down

0 comments on commit 5a1d09d

Please sign in to comment.