Skip to content

Commit

Permalink
fixed failing unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
Isha Gokhale committed Nov 7, 2023
1 parent 1cdd29e commit a12f5fc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
4 changes: 2 additions & 2 deletions casanovo/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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())
Expand All @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
14 changes: 2 additions & 12 deletions tests/unit_tests/test_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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)
config = Config(yml)

0 comments on commit a12f5fc

Please sign in to comment.