Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
huwjenkins committed Feb 29, 2024
1 parent 81f7ffc commit 8c3999f
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions tests/command_line/test_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -584,6 +584,39 @@ def test_shelx_ins_best_unit_cell(dials_data, tmp_path):
assert result == pytest.approx(cell_esds[instruction], abs=0.001)


def test_shelx_ins_composition(dials_data, tmp_path):
# Call dials.export
result = subprocess.run(
[
shutil.which("dials.export"),
"intensity=scale",
"format=shelx",
"composition=C3H7NO2S",
dials_data("l_cysteine_4_sweeps_scaled", pathlib=True)
/ "scaled_20_25.expt",
dials_data("l_cysteine_4_sweeps_scaled", pathlib=True)
/ "scaled_20_25.refl",
],
cwd=tmp_path,
capture_output=True,
)
assert not result.returncode and not result.stderr
assert (tmp_path / "dials.ins").is_file()

sfac_unit = {
"SFAC": "C H N O S",
"UNIT": "12 28 4 8 4",
}

with (tmp_path / "dials.ins").open() as fh:
for line in fh:
tokens = line.split()
instruction = tokens[0]
if instruction in sfac_unit:
result = " ".join(tokens[1:6])
assert result == sfac_unit[instruction]


def test_export_sum_or_profile_only(dials_data, tmp_path):
expt = dials_data("insulin_processed", pathlib=True) / "integrated.expt"
refl = dials_data("insulin_processed", pathlib=True) / "integrated.refl"
Expand Down

0 comments on commit 8c3999f

Please sign in to comment.