Skip to content

Commit 159bd95

Browse files
committed
fixed test function names
1 parent 0fca0a1 commit 159bd95

48 files changed

Lines changed: 384 additions & 385 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pyproject.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ dev = [{ include-group = "test" }, "ipython>=8.18.1"]
8282
override-dependencies = ["docutils>=0.20"]
8383

8484
[tool.pytest.ini_options]
85-
python_functions = "_test*"
8685
testpaths = ["tests"]
8786

8887

tests/test_atomselect.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ def _pdbmols():
113113

114114
@pytest.mark.parametrize("pdbid", _PDBIDS)
115115
@pytest.mark.parametrize("sel", _SELECTIONS)
116-
def _test_atomselect(pdbid, sel, _pdbmols):
116+
def test_atomselect(pdbid, sel, _pdbmols):
117117
from moleculekit.atomselect.analyze import analyze
118118
from moleculekit.atomselect.atomselect import atomselect
119119
import pickle
@@ -183,7 +183,7 @@ def _test_atomselect(pdbid, sel, _pdbmols):
183183
pickle.dump(results, f)
184184

185185

186-
def _test_empty_molecule():
186+
def test_empty_molecule():
187187
mol = Molecule()
188188
selections = [
189189
"all",
@@ -214,7 +214,7 @@ def _test_empty_molecule():
214214
assert res.dtype == bool, f"Expected bool dtype for '{sel}', got {res.dtype}"
215215

216216

217-
def _test_single_atom_molecule():
217+
def test_single_atom_molecule():
218218
mol = Molecule()
219219
mol.empty(1)
220220
mol.record[:] = "ATOM"
@@ -266,7 +266,7 @@ def _test_single_atom_molecule():
266266
assert not res[0], f"Expected False for '{sel}'"
267267

268268

269-
def _test_numprop_list_equality():
269+
def test_numprop_list_equality():
270270
pdb = os.path.join(curr_dir, "test_atomselect", "test.pdb")
271271
mol = Molecule(pdb)
272272
selections = ["beta 1 2", "beta 2 3"]
@@ -329,7 +329,7 @@ def _test_numprop_list_equality():
329329

330330

331331
@pytest.mark.parametrize("sel", _PARSER_SELECTIONS)
332-
def _test_parser(sel):
332+
def test_parser(sel):
333333
from moleculekit.atomselect._languageparser import parser
334334

335335
# Parse an expression

tests/test_atomtyper.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
HAS_OPENBABEL = True
1414

1515

16-
def _test_preparation():
16+
def test_preparation():
1717
from moleculekit.molecule import Molecule, mol_equal
1818
from moleculekit.tools.atomtyper import prepareProteinForAtomtyping
1919
from os import path
@@ -30,7 +30,7 @@ def _test_preparation():
3030
@pytest.mark.skipif(
3131
sys.platform.startswith("win"), reason="Windows OBabel fails at atom typing"
3232
)
33-
def _test_obabel_atomtyping():
33+
def test_obabel_atomtyping():
3434
from moleculekit.molecule import Molecule
3535
from moleculekit.tools.atomtyper import getPDBQTAtomTypesAndCharges
3636
from os import path

tests/test_autosegment.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
curr_dir = os.path.dirname(os.path.abspath(__file__))
66

77

8-
def _test_autoSegment2_deprecated_shim():
8+
def test_autoSegment2_deprecated_shim():
99
import warnings
1010
from moleculekit.molecule import Molecule
1111
from moleculekit.tools.autosegment import autoSegment, autoSegment2
@@ -26,7 +26,7 @@ def _test_autoSegment2_deprecated_shim():
2626
assert np.array_equal(shim.chain, ref.chain)
2727

2828

29-
def _test_autoSegment_classify():
29+
def test_autoSegment_classify():
3030
from moleculekit.molecule import Molecule
3131
from moleculekit.tools.autosegment import _classify_residues
3232

@@ -41,7 +41,7 @@ def _test_autoSegment_classify():
4141
assert "nucleic" not in cats
4242

4343

44-
def _test_autoSegment_linked():
44+
def test_autoSegment_linked():
4545
from moleculekit.molecule import Molecule
4646
from moleculekit.tools.autosegment import _polymer_linked, _classify_residues
4747

@@ -66,7 +66,7 @@ def _test_autoSegment_linked():
6666
assert np.mean(linked) > 0.95
6767

6868

69-
def _test_autoSegment_1aud_continuous():
69+
def test_autoSegment_1aud_continuous():
7070
from os import path
7171
from moleculekit.molecule import Molecule
7272
from moleculekit.tools.autosegment import autoSegment
@@ -78,14 +78,14 @@ def _test_autoSegment_1aud_continuous():
7878
assert len(rna_segids) == 1, f"expected 1 RNA segment, got {rna_segids}"
7979

8080

81-
def _test_autoSegment_3ptb_buckets():
81+
def test_autoSegment_3ptb_buckets():
8282
from moleculekit.molecule import Molecule
8383
from moleculekit.tools.autosegment import autoSegment
8484

8585
mol = Molecule("3ptb")
8686
out = autoSegment(mol, fields=("chain", "segid"))
8787

88-
# Same index ranges as the existing _test_autosegment_detailed
88+
# Same index ranges as the existing test_autosegment_detailed
8989
prot_idx = np.arange(1629)
9090
ca_idx = np.array([1629])
9191
ben_idx = np.arange(1630, 1639)
@@ -109,7 +109,7 @@ def _test_autoSegment_3ptb_buckets():
109109
assert len(set(groups)) == 4
110110

111111

112-
def _test_autoSegment_system_matrix():
112+
def test_autoSegment_system_matrix():
113113
from os import path
114114
from moleculekit.molecule import Molecule
115115
from moleculekit.tools.autosegment import autoSegment
@@ -132,7 +132,7 @@ def _test_autoSegment_system_matrix():
132132
assert got == n, f"{pid}: expected {n} segments, got {got}"
133133

134134

135-
def _test_autoSegment_chain_change_splits():
135+
def test_autoSegment_chain_change_splits():
136136
from moleculekit.molecule import Molecule
137137
from moleculekit.tools.autosegment import autoSegment
138138

@@ -148,7 +148,7 @@ def _test_autoSegment_chain_change_splits():
148148
assert len(set(out.segid[prot_idx])) >= 2
149149

150150

151-
def _test_autoSegment_single_other_segment():
151+
def test_autoSegment_single_other_segment():
152152
from os import path
153153
from moleculekit.molecule import Molecule
154154
from moleculekit.tools.autosegment import autoSegment, _classify_residues
@@ -172,7 +172,7 @@ def _test_autoSegment_single_other_segment():
172172
assert merged.segid[other_atoms][0] not in set(merged.segid[non_other])
173173

174174

175-
def _test_autoSegment_gfp_chromophore():
175+
def test_autoSegment_gfp_chromophore():
176176
# 1gfl: the GFP chromophore residue 65 (SER) is missing its backbone O, so
177177
# the standard "backbone" selection drops it. autoSegment classifies it by
178178
# N/CA/C presence and keeps each chain continuous through it.
@@ -191,7 +191,7 @@ def _test_autoSegment_gfp_chromophore():
191191
assert before[0] == after[0], f"chromophore split chain {ch}"
192192

193193

194-
def _test_autoSegment_missing_carbonyl_continuity():
194+
def test_autoSegment_missing_carbonyl_continuity():
195195
# 1hgu: residues 148/151 are missing their carbonyl O (AS2 over-splits there),
196196
# while 37-39 are a genuine missing loop. autoSegment stays continuous through
197197
# the missing-O residues but splits at the real gap.
@@ -213,7 +213,7 @@ def seg(rid):
213213
assert seg(36) != seg(40)
214214

215215

216-
def _test_autoSegment_heavy_water_dod():
216+
def test_autoSegment_heavy_water_dod():
217217
# 2mb5 is a neutron structure with 89 DOD (D2O) residues. With DOD recognized
218218
# as water they collapse into a single water segment instead of 89 'other' ones.
219219
from os import path
@@ -227,7 +227,7 @@ def _test_autoSegment_heavy_water_dod():
227227
assert len(set(out.segid[dod])) == 1
228228

229229

230-
def _test_autoSegment_glycan_tree():
230+
def test_autoSegment_glycan_tree():
231231
# 3gbn: an N-linked glycan tree (NAG-NAG-BMA-MAN) must stay together as one
232232
# connected-component 'other' segment, separate from isolated small molecules.
233233
from os import path
@@ -249,7 +249,7 @@ def _test_autoSegment_glycan_tree():
249249
assert len(multi[0]) >= 3
250250

251251

252-
def _test_autoSegment_5mat_internal_gaps():
252+
def test_autoSegment_5mat_internal_gaps():
253253
# 5MAT (renin) has two protein chains (A, C), each with a real missing-loop
254254
# gap, so autoSegment yields 4 polymer segments. The gaps are detected by
255255
# backbone distance (C-N 4.4 A in chain A, 10.4 A in chain C), not resids.

tests/test_bondguesser.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"5vav",
2626
],
2727
)
28-
def _test_bond_guessing(pdbid):
28+
def test_bond_guessing(pdbid):
2929
from moleculekit.molecule import Molecule, calculateUniqueBonds
3030
from moleculekit.bondguesser import guess_bonds
3131
import os
@@ -44,7 +44,7 @@ def _test_bond_guessing(pdbid):
4444
assert np.array_equal(bonds, bondsref)
4545

4646

47-
def _test_zero_atoms():
47+
def test_zero_atoms():
4848
from moleculekit.molecule import Molecule
4949
from moleculekit.bondguesser import guess_bonds
5050

@@ -54,7 +54,7 @@ def _test_zero_atoms():
5454
assert bonds.dtype == np.uint32
5555

5656

57-
def _test_single_atom():
57+
def test_single_atom():
5858
from moleculekit.molecule import Molecule
5959
from moleculekit.bondguesser import guess_bonds
6060

@@ -69,7 +69,7 @@ def _test_single_atom():
6969
assert bonds.dtype == np.uint32
7070

7171

72-
def _test_solvated_bond_guessing():
72+
def test_solvated_bond_guessing():
7373
from moleculekit.molecule import Molecule, calculateUniqueBonds
7474
from moleculekit.bondguesser import guess_bonds
7575
import os
@@ -85,7 +85,7 @@ def _test_solvated_bond_guessing():
8585

8686

8787
@pytest.mark.parametrize("span", [1e4, 1e5, 1e6, 1e7])
88-
def _test_unwrapped_coordinates(span):
88+
def test_unwrapped_coordinates(span):
8989
# Two bonded atoms plus distant ones spanning a large unwrapped range must not
9090
# crash bond_grid_search (regression: uint32 overflow on xyz_boxes products).
9191
from moleculekit.bondguesser import bond_grid_search
@@ -108,7 +108,7 @@ def _test_unwrapped_coordinates(span):
108108
assert sorted(bonds[0].tolist()) == [0, 1]
109109

110110

111-
def _test_high_atom_indices_preserved(monkeypatch):
111+
def test_high_atom_indices_preserved(monkeypatch):
112112
# Atom indices above 2**24 must survive the result-assembly path
113113
# (regression: float32 round-trip rounds odd indices and corrupts bonds).
114114
from moleculekit import bondguesser
@@ -139,7 +139,7 @@ def fake_grid_bonds(
139139
assert int(bonds[0, 1]) == HIGH_B
140140

141141

142-
def _test_nan_coords_raises():
142+
def test_nan_coords_raises():
143143
from moleculekit.bondguesser import bond_grid_search
144144

145145
coords = np.array(
@@ -152,7 +152,7 @@ def _test_nan_coords_raises():
152152
bond_grid_search(coords, 2.04, is_h, radii)
153153

154154

155-
def _test_zero_grid_cutoff_raises():
155+
def test_zero_grid_cutoff_raises():
156156
from moleculekit.bondguesser import bond_grid_search
157157

158158
coords = np.array([[0.0, 0.0, 0.0], [1.5, 0.0, 0.0]], dtype=np.float32)

tests/test_crystalpacking.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
curr_dir = os.path.dirname(os.path.abspath(__file__))
55

66

7-
def _test_crystalpacking_asymmetric_unit():
7+
def test_crystalpacking_asymmetric_unit():
88
from os.path import join
99
from moleculekit.molecule import Molecule, mol_equal
1010
from moleculekit.tools.crystalpacking import generateCrystalPacking
@@ -14,7 +14,7 @@ def _test_crystalpacking_asymmetric_unit():
1414
assert mol_equal(mol, refmol, fieldPrecision={"coords": 1e-3})
1515

1616

17-
def _test_crystalpacking_biological_unit():
17+
def test_crystalpacking_biological_unit():
1818
from os.path import join
1919
from moleculekit.molecule import Molecule, mol_equal
2020
from moleculekit.tools.crystalpacking import generateCrystalPacking

tests/test_detect.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def _compare(arr1, arr2):
1111
), f"Different results:\n{arr1}\n{arr2}"
1212

1313

14-
def _test_atom_detection():
14+
def test_atom_detection():
1515
import os
1616
from moleculekit.molecule import Molecule
1717
from moleculekit.tools.detect import detectEquivalentAtoms
@@ -29,7 +29,7 @@ def _test_atom_detection():
2929
_compare(eqgroupbyatom, eqgroupbyatom_ref)
3030

3131

32-
def _test_charged_detection():
32+
def test_charged_detection():
3333
import os
3434
from moleculekit.molecule import Molecule
3535
from moleculekit.tools.detect import detectEquivalentAtoms
@@ -59,7 +59,7 @@ def _test_charged_detection():
5959
_compare(eqgroupbyatom, eqgroupbyatom_ref)
6060

6161

62-
def _test_detect_dihedrals():
62+
def test_detect_dihedrals():
6363
import os
6464
from moleculekit.molecule import Molecule
6565
from moleculekit.tools.detect import detectParameterizableDihedrals

0 commit comments

Comments
 (0)