Skip to content

Commit

Permalink
Update test
Browse files Browse the repository at this point in the history
  • Loading branch information
tharun571 committed Jun 12, 2024
1 parent 8e91a9f commit 21d5cc2
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions test/test_xcpp_kernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class XCppNotebookTests(unittest.TestCase):
# Add more notebook names as needed
]

def test_notebooks(self):
def test_notebooks(self) -> None:
for name in self.notebook_names:

inp = f'Notebooks/{name}.ipynb'
Expand All @@ -167,15 +167,12 @@ def test_notebooks(self):
for i, (input_cell, output_cell) in enumerate(zip(input_nb.cells, output_nb.cells)):
if input_cell.cell_type == 'code' and output_cell.cell_type == 'code':
# If one cell has output and the other doesn't, set check to False
# if bool(input_cell.outputs) != bool(output_cell.outputs):
# self.fail(f"Cell {i} in notebook {name} has mismatched output presence")
self.assertEqual(bool(input_cell.outputs), bool(output_cell.outputs), f"Cell {i} in notebook {name} has mismatched output presence")
for input_output, output_output in zip(input_cell.outputs, output_cell.outputs):
self.assertEqual(input_output.get('text'), output_output.get('text'), f"Cell {i} in notebook {name} has mismatched output type")
# else:
# for input_output, output_output in zip(input_cell.outputs, output_cell.outputs):
# if input_output.get('text') != output_output.get('text'):
# self.fail(f"{input_output.get('text')} != {output_output.get('text')} Cell {i} in notebook {name} has mismatched output type")
if bool(input_cell.outputs) != bool(output_cell.outputs):
self.fail(f"Cell {i} in notebook {name} has mismatched output presence")
else:
for input_output, output_output in zip(input_cell.outputs, output_cell.outputs):
if input_output.get('text') != output_output.get('text'):
self.fail(f"{input_output.get('text')} != {output_output.get('text')} Cell {i} in notebook {name} has mismatched output type")


class XCppTests2(jupyter_kernel_test.KernelTests):
Expand Down

0 comments on commit 21d5cc2

Please sign in to comment.