From 2529886d613f2059a267b307e287fa2869cf58d6 Mon Sep 17 00:00:00 2001 From: Sam Cox Date: Tue, 5 Mar 2024 21:27:16 -0800 Subject: [PATCH] cleaning tests added --- tests/test_preprocess_tools.py | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) diff --git a/tests/test_preprocess_tools.py b/tests/test_preprocess_tools.py index 308aec8a..db83a8c5 100644 --- a/tests/test_preprocess_tools.py +++ b/tests/test_preprocess_tools.py @@ -33,15 +33,37 @@ def cleaning_fxns(get_registry): return CleaningTools(get_registry) +def test_standard_cleaning(path_to_cif, cleaning_fxns): + result = cleaning_fxns._standard_cleaning(path_to_cif) + path_to_cleaned_file = "tidy_" + path_to_cif + os.remove(path_to_cleaned_file) + msg = f"Cleaned File. Standard cleaning. Written to {path_to_cleaned_file}" + assert msg == result + + +def test_remove_water(path_to_cif, cleaning_fxns): + result = cleaning_fxns._remove_water(path_to_cif) + path_to_cleaned_file = "tidy_" + path_to_cif + os.remove(path_to_cleaned_file) + msg = f"Cleaned File. Removed water. Written to {path_to_cleaned_file}" + assert msg == result + + def test_add_hydrogens_and_remove_water(path_to_cif, cleaning_fxns): result = cleaning_fxns._add_hydrogens_and_remove_water(path_to_cif) path_to_cleaned_file = "tidy_" + path_to_cif os.remove(path_to_cleaned_file) - assert "Cleaned File" in result + msg = ( + f"Cleaned File. Missing Hydrogens " + f"added and water removed. Written to " + f"{path_to_cleaned_file}" + ) + assert msg == result -def test_standard_cleaning(path_to_cif, cleaning_fxns): - result = cleaning_fxns._standard_cleaning(path_to_cif) +def test_add_hyrogens(path_to_cif, cleaning_fxns): + result = cleaning_fxns._add_hydrogens(path_to_cif) path_to_cleaned_file = "tidy_" + path_to_cif os.remove(path_to_cleaned_file) - assert "Cleaned File" in result + msg = f"Cleaned File. Missing Hydrogens added. Written to {path_to_cleaned_file}" + assert msg == result