From 4130b9436e08b6e283e559327450f5f5db551837 Mon Sep 17 00:00:00 2001 From: Nicholas Devenish Date: Wed, 26 Jul 2023 14:41:57 +0100 Subject: [PATCH] Check Registry against refl/expt files (#650) This was previously done implicitly, but only when dials_regression was present. This makes the test explicit, and works with dials-data (so that it will work on e.g. CI with restricted access to test cases). --- newsfragments/650.misc | 1 + tests/format/test_format.py | 12 ++++++++++++ 2 files changed, 13 insertions(+) create mode 100644 newsfragments/650.misc create mode 100644 tests/format/test_format.py diff --git a/newsfragments/650.misc b/newsfragments/650.misc new file mode 100644 index 000000000..94f0ed982 --- /dev/null +++ b/newsfragments/650.misc @@ -0,0 +1 @@ +Format classes are now tested against invalid binary data with dials-data, for when dials-regression is not present. diff --git a/tests/format/test_format.py b/tests/format/test_format.py new file mode 100644 index 000000000..3b951ba8d --- /dev/null +++ b/tests/format/test_format.py @@ -0,0 +1,12 @@ +from __future__ import annotations + +from dxtbx.format import Registry + + +def test_reading_refl_failure(dials_data): + test_data = dials_data("centroid_test_data", pathlib=True) + + # Without dials_regression, none of the dials-data tests check for this "invalid binary data" case + assert Registry.get_format_class_for_file(test_data / "indexed.refl") is None + # Check .expt while here + assert Registry.get_format_class_for_file(test_data / "indexed.expt") is None