From ed97dce6df8d7253d7726b97edc513e0d5a51168 Mon Sep 17 00:00:00 2001 From: David Hendriks <davidhendriks93@gmail.com> Date: Thu, 19 Aug 2021 19:40:29 +0100 Subject: [PATCH] updated notebook testing --- binarycpython/tests/test_notebooks.py | 38 +++++++++++----------- examples/notebook_individual_systems.ipynb | 34 +++++++++---------- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/binarycpython/tests/test_notebooks.py b/binarycpython/tests/test_notebooks.py index a15041cbf..e90d2696f 100644 --- a/binarycpython/tests/test_notebooks.py +++ b/binarycpython/tests/test_notebooks.py @@ -46,19 +46,19 @@ class TestNotebook(unittest.TestCase): Class that contains the notebook test calls """ - # 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_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' @@ -67,12 +67,12 @@ class TestNotebook(unittest.TestCase): 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) + 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() diff --git a/examples/notebook_individual_systems.ipynb b/examples/notebook_individual_systems.ipynb index 8abd01f38..7aec69eae 100644 --- a/examples/notebook_individual_systems.ipynb +++ b/examples/notebook_individual_systems.ipynb @@ -27,7 +27,7 @@ }, { "cell_type": "code", - "execution_count": 2, + "execution_count": 16, "id": "e32dcdee", "metadata": {}, "outputs": [], @@ -39,7 +39,7 @@ }, { "cell_type": "code", - "execution_count": 3, + "execution_count": 17, "id": "425efed3-d8e3-432d-829e-41d8ebe05162", "metadata": {}, "outputs": [], @@ -50,7 +50,7 @@ }, { "cell_type": "code", - "execution_count": 4, + "execution_count": 18, "id": "b2abab48-433d-4936-8434-14804c52c9f6", "metadata": {}, "outputs": [ @@ -78,7 +78,7 @@ }, { "cell_type": "code", - "execution_count": 5, + "execution_count": 19, "id": "029fc3f2-f09a-49af-a32b-248505738f2e", "metadata": {}, "outputs": [ @@ -86,7 +86,7 @@ "name": "stdout", "output_type": "stream", "text": [ - " TIME M1 M2 K1 K2 SEP PER ECC R1/ROL1 R2/ROL2 TYPE RANDOM_SEED=66377 RANDOM_COUNT=0\n", + " TIME M1 M2 K1 K2 SEP PER ECC R1/ROL1 R2/ROL2 TYPE RANDOM_SEED=9935 RANDOM_COUNT=0\n", " 0.0000 1.000 0.000 1 15 -1 -1 -1.00 0.000 0.000 \"INITIAL \"\n", " 11003.1302 1.000 0.000 2 15 -1 -1 -1.00 0.000 0.000 \"OFF_MS\"\n", " 11003.1302 1.000 0.000 2 15 -1 -1 -1.00 0.000 0.000 \"TYPE_CHNGE\"\n", @@ -118,7 +118,7 @@ }, { "cell_type": "code", - "execution_count": 15, + "execution_count": 20, "id": "e6a23b55-ca42-440d-83ac-e76a24a83a67", "metadata": { "tags": [] @@ -167,7 +167,7 @@ }, { "cell_type": "code", - "execution_count": 7, + "execution_count": 21, "id": "3822721f-217a-495b-962e-d57137b9e290", "metadata": {}, "outputs": [ @@ -217,7 +217,7 @@ }, { "cell_type": "code", - "execution_count": 8, + "execution_count": 22, "id": "654a07ed-2a88-46ff-9da0-b7759580f9f3", "metadata": {}, "outputs": [ @@ -268,7 +268,7 @@ }, { "cell_type": "code", - "execution_count": 9, + "execution_count": 23, "id": "4a98ffca-1b72-4bb8-8df1-3bf3187d882f", "metadata": {}, "outputs": [], @@ -287,7 +287,7 @@ }, { "cell_type": "code", - "execution_count": 10, + "execution_count": 24, "id": "bff1cc2e-6b32-4ba0-879f-879ffbabd223", "metadata": {}, "outputs": [ @@ -333,7 +333,7 @@ }, { "cell_type": "code", - "execution_count": 11, + "execution_count": 25, "id": "dd748bab-b57e-4129-8350-9ea11fa179d0", "metadata": { "scrolled": true, @@ -358,7 +358,7 @@ "Creating and loading custom logging functionality\n", "Running binary_c M_1 10 api_log_filename_prefix /tmp/binary_c_python/notebooks/notebook_individual_systems\n", "Cleaning up the custom logging stuff. type: single\n", - "Removed /tmp/binary_c_python/custom_logging/libcustom_logging_e8bb03f627db4256b2f4ee3d99b66094.so\n", + "Removed /tmp/binary_c_python/custom_logging/libcustom_logging_491813c1f1184f97951202e364eb3b55.so\n", "EXAMPLE_MASSLOSS 0.000000000000e+00 10 0 10 1\n", "EXAMPLE_MASSLOSS 0.000000000000e+00 10 10 10 1\n", "EXAMPLE_MASSLOSS 1.000000000000e-06 10 10 10 1\n", @@ -398,7 +398,7 @@ }, { "cell_type": "code", - "execution_count": 12, + "execution_count": 26, "id": "fec39154-cce6-438c-8c2c-509d76b00f34", "metadata": {}, "outputs": [], @@ -449,7 +449,7 @@ }, { "cell_type": "code", - "execution_count": 13, + "execution_count": 27, "id": "57347512-fd4a-434b-b13c-5e6dbd3ac415", "metadata": { "scrolled": true, @@ -460,13 +460,13 @@ "name": "stdout", "output_type": "stream", "text": [ - "adding: parse_function=<function object_parse_function at 0x7fa30c1f86a8> to grid_options\n", + "adding: parse_function=<function object_parse_function at 0x7fa3136e5378> to grid_options\n", "<<<< Warning: Key does not match previously known parameter: adding: output_dir=/tmp/binary_c_python/notebooks/notebook_individual_systems to custom_options >>>>\n", "adding: api_log_filename_prefix=/tmp/binary_c_python/notebooks/notebook_individual_systems to BSE_options\n", "Creating and loading custom logging functionality\n", "Running binary_c M_1 10 api_log_filename_prefix /tmp/binary_c_python/notebooks/notebook_individual_systems\n", "Cleaning up the custom logging stuff. type: single\n", - "Removed /tmp/binary_c_python/custom_logging/libcustom_logging_6557922fae4b4d6fae29df772d4f8ce6.so\n", + "Removed /tmp/binary_c_python/custom_logging/libcustom_logging_83729c10ca52451cb773d29d6b28ea96.so\n", "[['time', 'mass', 'initial_mass', 'stellar_type'], [0.0, 10.0, 0.0, 10.0, 1.0], [0.0, 10.0, 10.0, 10.0, 1.0], [1e-06, 10.0, 10.0, 10.0, 1.0]]\n", "dict_keys(['time', 'mass', 'initial_mass', 'stellar_type'])\n" ] @@ -511,7 +511,7 @@ }, { "cell_type": "code", - "execution_count": 14, + "execution_count": 28, "id": "ec48125c-6bf5-48f4-9357-8261800b5d8b", "metadata": {}, "outputs": [ -- GitLab