Loading tests/core/test_run_system.py +6 −5 Original line number Diff line number Diff line import binary_c_python_api import textwrap Loading @@ -25,9 +23,12 @@ def test_run_system(): output = binary_c_python_api.run_system(argstring=argstring) print("function: test_run_system") print("Binary_c output:") print(textwrap.indent(output, "\t")) # print("function: test_run_system") # print("Binary_c output:") # print(textwrap.indent(output, "\t")) assert "SINGLE_STAR_LIFETIME" in output, "Run system not working properly" #### if __name__ == "__main__": Loading tests/function_tests.py +5 −3 Original line number Diff line number Diff line Loading @@ -23,8 +23,6 @@ def test_get_help_super(): assert 'algorithms' in get_help_super_keys, "missing section" assert 'misc' in get_help_super_keys, "missing section" print(get_help_super_output.keys()) def test_get_help_all(): """ Function to test the get_help_all function Loading @@ -48,7 +46,11 @@ def test_get_help(): assert get_help("M_1", print_help=False)['parameter_name'] == 'M_1', "get_help('M_1') should return the correct parameter name" if __name__ == "__main__": def test_all(): test_get_help() test_get_help_all() test_get_help_super() if __name__ == "__main__": test_all() No newline at end of file tests/main.py +6 −1 Original line number Diff line number Diff line # Main file for the tests. This file imports all the combined_test functions from all files. from population.grid_tests import test_all as test_all_grid_tests from function_tests import test_all as test_all_function_tests test_all_grid_tests() test_all_function_tests() No newline at end of file tests/population/grid_tests.py +44 −44 Original line number Diff line number Diff line Loading @@ -162,8 +162,6 @@ def test_C_auto_logging_population(): output = test_pop.evolve_single() print(output.splitlines()[0].split()) first_line = output.splitlines()[0].split() assert first_line[0] == "MY_HEADER_LINE" , "Failed to set the custom logging correctly" Loading Loading @@ -266,21 +264,23 @@ def test_parse_function_population(): assert first_line_split[2] == 'probability', "Output header not created correctly" assert len(output) > 1, "File doesn't seem to contain any real data" def test_all(): test_setup_population() test_set_value_population() test_set_argline_output_population() test_version_info_dict_population() test_settings_output_population() test_all_info_population() test_evolve_single_system_population() test_C_auto_logging_population() test_C_logging_code_population() test_parse_function_population() if __name__ == "__main__": # test_setup_population() # test_set_value_population() # test_set_argline_output_population() # test_version_info_dict_population() # test_settings_output_population() # test_all_info_population() # test_evolve_single_system_population() # test_C_auto_logging_population() # test_C_logging_code_population() # test_parse_function_population() test_all() print('yo') quit() # quit() # print(len(test_pop.return_binary_c_defaults())) # print('\n\n') # print(len(test_pop.cleanup_defaults())) Loading Loading @@ -366,41 +366,41 @@ quit() # ### # testing population: test_pop.set( verbose=1, amt_cores=2, binary=0, ) # test_pop.set( # verbose=1, amt_cores=2, binary=0, # ) resolution = {"M_1": 10, "per": 10} # resolution = {"M_1": 10, "per": 10} test_pop.add_grid_variable( name="M_1", longname="log primary mass", valuerange=[10, 100], resolution="{}".format(resolution["M_1"]), spacingfunc="const(10, 100, {})".format(resolution["M_1"]), # precode="M_1=math.exp(lnm1)", probdist="flat(M_1)", # probdist='self.custom_options["extra_prob_function"](M_1)', dphasevol="dM_1", parameter_name="M_1", ) # test_pop.add_grid_variable( # name="M_1", # longname="log primary mass", # valuerange=[10, 100], # resolution="{}".format(resolution["M_1"]), # spacingfunc="const(10, 100, {})".format(resolution["M_1"]), # # precode="M_1=math.exp(lnm1)", # probdist="flat(M_1)", # # probdist='self.custom_options["extra_prob_function"](M_1)', # dphasevol="dM_1", # parameter_name="M_1", # ) ### Grid generating test. test_pop.add_grid_variable( name="period", longname="period", valuerange=["M_1", 20], resolution="{}".format(resolution["per"]), spacingfunc="np.linspace(1, 10, {})".format(resolution["per"]), precode="orbital_period = period**2", probdist="flat(orbital_period)", parameter_name="orbital_period", dphasevol="dper", condition='self.grid_options["binary"]==0', ) # ### Grid generating test. # test_pop.add_grid_variable( # name="period", # longname="period", # valuerange=["M_1", 20], # resolution="{}".format(resolution["per"]), # spacingfunc="np.linspace(1, 10, {})".format(resolution["per"]), # precode="orbital_period = period**2", # probdist="flat(orbital_period)", # parameter_name="orbital_period", # dphasevol="dper", # condition='self.grid_options["binary"]==0', # ) test_pop.set(verbose=1, amt_cores=2, binary=0, evolution_type="linear") # test_pop.set(verbose=1, amt_cores=2, binary=0, evolution_type="linear") # test_pop.evolve_population() Loading tests/python_API_test.py +0 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,6 @@ import textwrap ############################################################ # Test script for the api functions # TODO: Add asserts to these functions and use em as # unittests ############################################################ Loading Loading
tests/core/test_run_system.py +6 −5 Original line number Diff line number Diff line import binary_c_python_api import textwrap Loading @@ -25,9 +23,12 @@ def test_run_system(): output = binary_c_python_api.run_system(argstring=argstring) print("function: test_run_system") print("Binary_c output:") print(textwrap.indent(output, "\t")) # print("function: test_run_system") # print("Binary_c output:") # print(textwrap.indent(output, "\t")) assert "SINGLE_STAR_LIFETIME" in output, "Run system not working properly" #### if __name__ == "__main__": Loading
tests/function_tests.py +5 −3 Original line number Diff line number Diff line Loading @@ -23,8 +23,6 @@ def test_get_help_super(): assert 'algorithms' in get_help_super_keys, "missing section" assert 'misc' in get_help_super_keys, "missing section" print(get_help_super_output.keys()) def test_get_help_all(): """ Function to test the get_help_all function Loading @@ -48,7 +46,11 @@ def test_get_help(): assert get_help("M_1", print_help=False)['parameter_name'] == 'M_1', "get_help('M_1') should return the correct parameter name" if __name__ == "__main__": def test_all(): test_get_help() test_get_help_all() test_get_help_super() if __name__ == "__main__": test_all() No newline at end of file
tests/main.py +6 −1 Original line number Diff line number Diff line # Main file for the tests. This file imports all the combined_test functions from all files. from population.grid_tests import test_all as test_all_grid_tests from function_tests import test_all as test_all_function_tests test_all_grid_tests() test_all_function_tests() No newline at end of file
tests/population/grid_tests.py +44 −44 Original line number Diff line number Diff line Loading @@ -162,8 +162,6 @@ def test_C_auto_logging_population(): output = test_pop.evolve_single() print(output.splitlines()[0].split()) first_line = output.splitlines()[0].split() assert first_line[0] == "MY_HEADER_LINE" , "Failed to set the custom logging correctly" Loading Loading @@ -266,21 +264,23 @@ def test_parse_function_population(): assert first_line_split[2] == 'probability', "Output header not created correctly" assert len(output) > 1, "File doesn't seem to contain any real data" def test_all(): test_setup_population() test_set_value_population() test_set_argline_output_population() test_version_info_dict_population() test_settings_output_population() test_all_info_population() test_evolve_single_system_population() test_C_auto_logging_population() test_C_logging_code_population() test_parse_function_population() if __name__ == "__main__": # test_setup_population() # test_set_value_population() # test_set_argline_output_population() # test_version_info_dict_population() # test_settings_output_population() # test_all_info_population() # test_evolve_single_system_population() # test_C_auto_logging_population() # test_C_logging_code_population() # test_parse_function_population() test_all() print('yo') quit() # quit() # print(len(test_pop.return_binary_c_defaults())) # print('\n\n') # print(len(test_pop.cleanup_defaults())) Loading Loading @@ -366,41 +366,41 @@ quit() # ### # testing population: test_pop.set( verbose=1, amt_cores=2, binary=0, ) # test_pop.set( # verbose=1, amt_cores=2, binary=0, # ) resolution = {"M_1": 10, "per": 10} # resolution = {"M_1": 10, "per": 10} test_pop.add_grid_variable( name="M_1", longname="log primary mass", valuerange=[10, 100], resolution="{}".format(resolution["M_1"]), spacingfunc="const(10, 100, {})".format(resolution["M_1"]), # precode="M_1=math.exp(lnm1)", probdist="flat(M_1)", # probdist='self.custom_options["extra_prob_function"](M_1)', dphasevol="dM_1", parameter_name="M_1", ) # test_pop.add_grid_variable( # name="M_1", # longname="log primary mass", # valuerange=[10, 100], # resolution="{}".format(resolution["M_1"]), # spacingfunc="const(10, 100, {})".format(resolution["M_1"]), # # precode="M_1=math.exp(lnm1)", # probdist="flat(M_1)", # # probdist='self.custom_options["extra_prob_function"](M_1)', # dphasevol="dM_1", # parameter_name="M_1", # ) ### Grid generating test. test_pop.add_grid_variable( name="period", longname="period", valuerange=["M_1", 20], resolution="{}".format(resolution["per"]), spacingfunc="np.linspace(1, 10, {})".format(resolution["per"]), precode="orbital_period = period**2", probdist="flat(orbital_period)", parameter_name="orbital_period", dphasevol="dper", condition='self.grid_options["binary"]==0', ) # ### Grid generating test. # test_pop.add_grid_variable( # name="period", # longname="period", # valuerange=["M_1", 20], # resolution="{}".format(resolution["per"]), # spacingfunc="np.linspace(1, 10, {})".format(resolution["per"]), # precode="orbital_period = period**2", # probdist="flat(orbital_period)", # parameter_name="orbital_period", # dphasevol="dper", # condition='self.grid_options["binary"]==0', # ) test_pop.set(verbose=1, amt_cores=2, binary=0, evolution_type="linear") # test_pop.set(verbose=1, amt_cores=2, binary=0, evolution_type="linear") # test_pop.evolve_population() Loading
tests/python_API_test.py +0 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,6 @@ import textwrap ############################################################ # Test script for the api functions # TODO: Add asserts to these functions and use em as # unittests ############################################################ Loading