Skip to content

Commit 21d5cc2

Browse files
committed
Update test
1 parent 8e91a9f commit 21d5cc2

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

test/test_xcpp_kernel.py

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ class XCppNotebookTests(unittest.TestCase):
141141
# Add more notebook names as needed
142142
]
143143

144-
def test_notebooks(self):
144+
def test_notebooks(self) -> None:
145145
for name in self.notebook_names:
146146

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

180177

181178
class XCppTests2(jupyter_kernel_test.KernelTests):

0 commit comments

Comments
 (0)