Skip to content

Commit f20847d

Browse files
authored
try to fix tests (#170)
use some smaller test pdbs for tests
1 parent b525b84 commit f20847d

File tree

4 files changed

+12
-4
lines changed

4 files changed

+12
-4
lines changed

tests/test_af3.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,8 @@
6363
default_extract_atompair_feats_fn
6464
)
6565

66+
DATA_TEST_PDB_ID = '721p'
67+
6668
def test_atom_ref_pos_to_atompair_inputs():
6769
atom_ref_pos = torch.randn(16, 3)
6870
atom_ref_space_uid = torch.ones(16).long()
@@ -1095,7 +1097,7 @@ def test_unresolved_protein_rasa():
10951097

10961098
# rest of the test
10971099

1098-
mmcif_filepath = os.path.join('data', 'test', '7a4d-assembly1.cif')
1100+
mmcif_filepath = os.path.join('data', 'test', f'{DATA_TEST_PDB_ID}-assembly1.cif')
10991101
pdb_input = PDBInput(mmcif_filepath)
11001102

11011103
mol_input = pdb_input_to_molecule_input(pdb_input)

tests/test_input.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626

2727
from alphafold3_pytorch.mocks import MockAtomDataset
2828

29+
DATA_TEST_PDB_ID = '7a4d'
30+
2931
# reverse complements
3032

3133
def test_string_reverse_complement():
@@ -187,7 +189,7 @@ def test_atompos_input():
187189

188190
def test_pdbinput_input():
189191
"""Test the PDBInput class, particularly its input transformations for mmCIF files."""
190-
filepath = os.path.join("data", "test", "7a4d-assembly1.cif")
192+
filepath = os.path.join("data", "test", f"{DATA_TEST_PDB_ID}-assembly1.cif")
191193
file_id = os.path.splitext(os.path.basename(filepath))[0]
192194
assert os.path.exists(filepath), f"File {filepath} does not exist."
193195

tests/test_trainer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
from alphafold3_pytorch.mocks import MockAtomDataset
2626

27+
DATA_TEST_PDB_ID = '209d'
28+
2729
def exists(v):
2830
return v is not None
2931

@@ -135,7 +137,7 @@ def test_trainer_with_mock_atom_input(remove_test_folders):
135137
@pytest.fixture()
136138
def populate_mock_pdb_and_remove_test_folders():
137139
proj_root = Path('.')
138-
working_cif_file = proj_root / 'data' / 'test' / '7a4d-assembly1.cif'
140+
working_cif_file = proj_root / 'data' / 'test' / f'{DATA_TEST_PDB_ID}-assembly1.cif'
139141

140142
pytest_root_folder = Path('./test-folder')
141143
data_folder = pytest_root_folder / 'data'

tests/test_weighted_sampling.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@
1515
create_trainer_from_yaml
1616
)
1717

18+
DATA_TEST_PDB_ID = '209d'
19+
1820
TEST_FOLDER = Path('./data/test')
1921

2022
INTERFACE_MAPPING_PATH = str(TEST_FOLDER / "interface_cluster_mapping.csv")
@@ -54,7 +56,7 @@ def test_cluster_based_sample(sampler: Sampler):
5456
@pytest.fixture()
5557
def populate_mock_pdb_and_remove_test_folders():
5658
proj_root = Path('.')
57-
working_cif_file = proj_root / 'data' / 'test' / '7a4d-assembly1.cif'
59+
working_cif_file = proj_root / 'data' / 'test' / f'{DATA_TEST_PDB_ID}-assembly1.cif'
5860

5961
pytest_root_folder = Path('./test-folder')
6062
data_folder = pytest_root_folder / 'data'

0 commit comments

Comments
 (0)