Download construction/tests/test_release_guards.py from HFMI-PROFOUND/BILBY-PRO: direct link, hf CLI and curl.
- Browser
- Download file 1.57 kB
-
https://huggingface.co/datasets/HFMI-PROFOUND/BILBY-PRO/resolve/main/construction/tests/test_release_guards.py
- Command line
-
hf download hf://datasets/HFMI-PROFOUND/BILBY-PRO/construction/tests/test_release_guards.py
-
curl -L -o test_release_guards.py https://huggingface.co/datasets/HFMI-PROFOUND/BILBY-PRO/resolve/main/construction/tests/test_release_guards.py
1.57 kB
| # Copyright 2026 Emile de Bruyn | |
| # SPDX-License-Identifier: Apache-2.0 | |
| from types import SimpleNamespace | |
| import pandas as pd | |
| import pytest | |
| from motifbench_prosite.structure_analysis import RMSDAnalysisConfig, compute_motif_stats | |
| from motifbench_prosite.unified_export import run_unified_export | |
| from motifbench_prosite import pdb_io | |
| from test_structure_analysis import _FakeFsCfg, _FakeFsRunner, _make_dummy_dataset | |
| def test_empty_foldseek_clusters_fail(tmp_path): | |
| with pytest.raises(ValueError, match="no clusters"): | |
| compute_motif_stats( | |
| _make_dummy_dataset(), | |
| RMSDAnalysisConfig(min_instances=1, rmsd_threshold=5, cluster_threshold=5), | |
| max_workers=1, foldseek_runner=_FakeFsRunner([]), | |
| foldseek_cfg=_FakeFsCfg(), tmpdir=tmp_path, | |
| ) | |
| def test_foldseek_conservation_does_not_fall_back_to_rmsd(tmp_path): | |
| cfg = SimpleNamespace( | |
| output_root=tmp_path, | |
| structure_analysis=SimpleNamespace(foldseek_conservation=True), | |
| ) | |
| stats = pd.DataFrame([{"motif_entry": "E1", "median_pairwise_rmsd": 1.0}]) | |
| with pytest.raises(RuntimeError, match="no cluster statistics"): | |
| run_unified_export(cfg, pd.DataFrame([{"entry": "E1"}]), _make_dummy_dataset(), stats) | |
| def test_failed_downloads_are_not_silently_ignored(tmp_path, monkeypatch): | |
| monkeypatch.setattr(pdb_io, "_download_worker", lambda payload: ("ABCD", False, False, True)) | |
| with pytest.raises(RuntimeError, match="ABCD"): | |
| pdb_io.download_pdbs(["ABCD"], tmp_path, max_workers=1, use_processes=False) | |