From d3f5b316e7c175620dfb406349741018a060c617 Mon Sep 17 00:00:00 2001 From: David Hendriks <davidhendriks93@gmail.com> Date: Fri, 8 Jan 2021 19:12:06 +0000 Subject: [PATCH] added tests for grid_option_defaults --- .../tests/test_grid_options_defaults.py | 35 ++++++++++++++++++- binarycpython/tests/test_spacing_functions.py | 2 +- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/binarycpython/tests/test_grid_options_defaults.py b/binarycpython/tests/test_grid_options_defaults.py index c4fe47400..9692f0da4 100644 --- a/binarycpython/tests/test_grid_options_defaults.py +++ b/binarycpython/tests/test_grid_options_defaults.py @@ -7,10 +7,14 @@ binary_c_temp_dir = temp_dir() class test_grid_options_defaults(unittest.TestCase): """ - Unit test for the custom_logging module + Unit tests for the grid_options_defaults module """ def test_grid_options_help(self): + """ + Unit tests for the grid_options_help function + """ + input_1 = "aa" result_1 = grid_options_help(input_1) self.assertEqual(result_1, {}, msg="Dict should be empty") @@ -35,6 +39,35 @@ class test_grid_options_defaults(unittest.TestCase): ) self.assertEqual(result_3[input_3], "", msg="description should be empty") + def test_grid_options_description_checker(self): + """ + Unit tests for the grid_options_description_checker function + """ + + output_1 = grid_options_description_checker(print_info=True) + + self.assertTrue(isinstance(output_1, int)) + self.assertTrue(output_1>0) + + + + def test_write_grid_options_to_rst_file(self): + """ + Unit tests for the grid_options_description_checker function + """ + + input_1 = os.path.join(binary_c_temp_dir, "test_write_grid_options_to_rst_file_1.txt") + output_1 = write_grid_options_to_rst_file(input_1) + self.assertIsNone(output_1) + + + input_2 = os.path.join(binary_c_temp_dir, "test_write_grid_options_to_rst_file_2.rst") + output_2 = write_grid_options_to_rst_file(input_2) + + self.assertTrue(os.path.isfile(input_2)) + + +write_grid_options_to_rst_file if __name__ == "__main__": unittest.main() diff --git a/binarycpython/tests/test_spacing_functions.py b/binarycpython/tests/test_spacing_functions.py index 2826ae298..aff7ff139 100644 --- a/binarycpython/tests/test_spacing_functions.py +++ b/binarycpython/tests/test_spacing_functions.py @@ -12,6 +12,6 @@ class test_spacing_functions(unittest.TestCase): const_return = const(1, 10, 10) self.assertEqual( const_return, - np.linespace(1, 10, 10), + np.linspace(1, 10, 10), msg="Output didn't contain SINGLE_STAR_LIFETIME", ) -- GitLab