Skip to content

Commit

Permalink
revert pytest fixtures
Browse files Browse the repository at this point in the history
  • Loading branch information
kmdalton committed Jan 1, 2025
1 parent 53d76b3 commit d7ec1a8
Showing 1 changed file with 26 additions and 38 deletions.
64 changes: 26 additions & 38 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,32 @@
import reciprocalspaceship as rs


@pytest.fixture
def hkls():
"""
Return all Miller indices with H, K, L values between [-5, 5]
"""
hmin, hmax = -5, 5
H = np.mgrid[hmin : hmax + 1, hmin : hmax + 1, hmin : hmax + 1].reshape((3, -1)).T
return H


@pytest.fixture
def dataset_hkl():
"""
Build DataSet for testing containing only Miller indices
"""
hmin, hmax = -5, 5
H = (
np.mgrid[hmin : hmax + 1 : 2, hmin : hmax + 1 : 2, hmin : hmax + 1 : 2]
.reshape((3, -1))
.T
)
dataset = rs.DataSet({"H": H[:, 0], "K": H[:, 1], "L": H[:, 2]})
dataset.set_index(["H", "K", "L"], inplace=True)
return dataset


def load_dataset(datapath, as_gemmi=False):
"""
Load dataset at given datapath. Datapath is expected to be a list of
Expand Down Expand Up @@ -39,44 +65,6 @@ def data_unmerged():
return load_dataset(datapath)


@pytest.fixture
def hkls(data_merged):
"""
Return all Miller indices with H, K, L values between [-5, 5]
"""
return data_merged.hkls


@pytest.fixture
def dataset_hkl(data_merged):
"""
Build DataSet for testing containing only Miller indices
"""
H = data_merged.hkls
dataset = rs.DataSet({"H": H[:, 0], "K": H[:, 1], "L": H[:, 2]})
dataset.set_index(["H", "K", "L"], inplace=True)
return dataset


@pytest.fixture
def hkls_unmerged(data_unmerged):
"""
Return all Miller indices with H, K, L values between [-5, 5]
"""
return data_unmerged.hkls


@pytest.fixture
def dataset_hkl_unmerged(data_unmerged):
"""
Build DataSet for testing containing only Miller indices
"""
H = data_unmerged.hkls
dataset = rs.DataSet({"H": H[:, 0], "K": H[:, 1], "L": H[:, 2]})
dataset.set_index(["H", "K", "L"], inplace=True)
return dataset


@pytest.fixture(
params=[
["data", "data_merged.mtz"],
Expand Down

0 comments on commit d7ec1a8

Please sign in to comment.