From 09549a7ef801e610d9b65976814273ac96859e26 Mon Sep 17 00:00:00 2001 From: David Hendriks <davidhendriks93@gmail.com> Date: Thu, 19 Aug 2021 19:26:43 +0100 Subject: [PATCH] working on the notebook testcases --- binarycpython/tests/test_notebooks.py | 29 ++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/binarycpython/tests/test_notebooks.py b/binarycpython/tests/test_notebooks.py index 276dc6bab..a15041cbf 100644 --- a/binarycpython/tests/test_notebooks.py +++ b/binarycpython/tests/test_notebooks.py @@ -9,6 +9,7 @@ from nbconvert.preprocessors import ExecutePreprocessor from binarycpython.utils.functions import temp_dir TMP_DIR = temp_dir('testing', 'test_notebooks') +NOTEBOOKS_DIR = os.path.abspath(os.path.join(os.path.abspath(__file__), '../../../examples')) def run_notebook(notebook_path): """ @@ -45,11 +46,33 @@ class TestNotebook(unittest.TestCase): Class that contains the notebook test calls """ - def test_example(self): - notebook_name = 'example.ipynb' - nb, errors = run_notebook(notebook_name) + # def test_notebook_api_functionality(self): + # notebook_name = 'notebook_api_functionality.ipynb' + # full_notebook_path = os.path.join(NOTEBOOKS_DIR, notebook_name) + # nb, errors = run_notebook(full_notebook_path) + # msg = "\nNotebook: {}\n\n".format(notebook_name) + "\n".join(["{}: {}\n{}".format(el['ename'], el['evalue'], '\n'.join(el['traceback'])) for el in errors]) + # self.assertEqual(errors, [], msg=msg) + + # def test_notebook_population(self): + # notebook_name = 'notebook_population.ipynb' + # full_notebook_path = os.path.join(NOTEBOOKS_DIR, notebook_name) + # nb, errors = run_notebook(full_notebook_path) + # msg = "\nNotebook: {}\n\n".format(notebook_name) + "\n".join(["{}: {}\n{}".format(el['ename'], el['evalue'], '\n'.join(el['traceback'])) for el in errors]) + # self.assertEqual(errors, [], msg=msg) + + def test_notebook_individual_systems(self): + notebook_name = 'notebook_individual_systems.ipynb' + full_notebook_path = os.path.join(NOTEBOOKS_DIR, notebook_name) + nb, errors = run_notebook(full_notebook_path) msg = "\nNotebook: {}\n\n".format(notebook_name) + "\n".join(["{}: {}\n{}".format(el['ename'], el['evalue'], '\n'.join(el['traceback'])) for el in errors]) self.assertEqual(errors, [], msg=msg) + # def test_notebook_extra_features(self): + # notebook_name = 'notebook_extra_features.ipynb' + # full_notebook_path = os.path.join(NOTEBOOKS_DIR, notebook_name) + # nb, errors = run_notebook(full_notebook_path) + # msg = "\nNotebook: {}\n\n".format(notebook_name) + "\n".join(["{}: {}\n{}".format(el['ename'], el['evalue'], '\n'.join(el['traceback'])) for el in errors]) + # self.assertEqual(errors, [], msg=msg) + if __name__ == '__main__': unittest.main() -- GitLab