From a12f5fc149bf878628e4c0f41d1ba89a9af699cd Mon Sep 17 00:00:00 2001 From: Isha Gokhale Date: Mon, 6 Nov 2023 20:41:48 -0800 Subject: [PATCH] fixed failing unit test --- casanovo/config.py | 4 ++-- tests/conftest.py | 2 -- tests/unit_tests/test_config.py | 14 ++------------ 3 files changed, 4 insertions(+), 16 deletions(-) diff --git a/casanovo/config.py b/casanovo/config.py index 16d9ea1b..9514cacd 100644 --- a/casanovo/config.py +++ b/casanovo/config.py @@ -83,7 +83,7 @@ def __init__(self, config_file: Optional[str] = None): else: with Path(config_file).open() as f_in: self._user_config = yaml.safe_load(f_in) - """ + # check for missing entries in config file if len(self._user_config.keys()) < len(self._params.keys()): keys_set = set(self._params.keys()) @@ -95,7 +95,7 @@ def __init__(self, config_file: Optional[str] = None): for key, val in self._user_config.items(): if key not in keys: raise KeyError(f"Unrecognized config file entry {key}") - """ + # Validate: for key, val in self._config_types.items(): self.validate_param(key, val) diff --git a/tests/conftest.py b/tests/conftest.py index 02d5015d..70ac2cbb 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -214,14 +214,12 @@ def tiny_config(tmp_path): "remove_precursor_tol": 2.0, "max_charge": 10, "dim_model": 512, - "n_head": 8, "dropout": 0.0, "dim_intensity": None, "max_length": 100, "learning_rate": 5e-4, "weight_decay": 1e-5, "train_batch_size": 32, - "max_epochs": 30, "num_sanity_val_steps": 0, "train_from_scratch": True, "calculate_precision": False, diff --git a/tests/unit_tests/test_config.py b/tests/unit_tests/test_config.py index 7d374048..4d1bb17f 100644 --- a/tests/unit_tests/test_config.py +++ b/tests/unit_tests/test_config.py @@ -27,7 +27,7 @@ def test_override(tmp_path, tiny_config): T: 4 """ ) - """ + with open(tiny_config, "r") as read_file: contents = yaml.safe_load(read_file) contents["random_seed_"] = 354 @@ -38,14 +38,4 @@ def test_override(tmp_path, tiny_config): config = Config("output.yml") with pytest.raises(KeyError): - config = Config(yml) - """ - config = Config(yml) - assert config.random_seed == 42 - assert config["random_seed"] == 42 - assert config.accelerator == "auto" - assert config.top_match == 3 - assert len(config.residues) == 4 - for i, residue in enumerate("WOUT", 1): - assert config["residues"][residue] == i - assert config.file == str(yml) \ No newline at end of file + config = Config(yml) \ No newline at end of file