id3c.tests.test_expected_frame_count#
Tests for id3c.plans.flyscan_3idc._expected_frame_count.
The helper provides the “expected” frame count stamped as provenance
on /entry/flyscan_data (issue #12, phase A). It must:
prefer the authoritative AD HDF1 file count when a path is given;
fall back to the start document’s
num_framesotherwise;return
Nonewhen neither source is available;never raise.
Synthetic AD files are built via h5py; runs are duck-typed dicts. No IOC, no live detector, no catalog.
Attributes#
Functions#
|
When the AD file is openable, its UID row count is returned. |
With ad_file_path=None, the start-doc num_frames is used. |
|
A non-openable AD path falls through to num_frames. |
|
An AD file without the UID dataset falls through to num_frames. |
|
|
No AD file and no num_frames -> None (not an exception). |
An explicit num_frames=None is treated as absent. |
|
A run object with no usable metadata yields None, not an error. |
|
AD file count is returned regardless of a broken run object. |
|
|
The result is a built-in int (HDF5/JSON attr friendly). |
Module Contents#
- id3c.tests.test_expected_frame_count.UID_DSET = '/entry/instrument/detector/NDAttributes/NDArrayUniqueId'[source]#
- id3c.tests.test_expected_frame_count.test_ad_file_count_is_authoritative(tmp_path)[source]#
When the AD file is openable, its UID row count is returned.
- id3c.tests.test_expected_frame_count.test_falls_back_to_num_frames_when_no_ad_path()[source]#
With ad_file_path=None, the start-doc num_frames is used.
- id3c.tests.test_expected_frame_count.test_falls_back_to_num_frames_when_ad_file_missing(tmp_path)[source]#
A non-openable AD path falls through to num_frames.
- id3c.tests.test_expected_frame_count.test_falls_back_when_ad_file_lacks_uid_dataset(tmp_path)[source]#
An AD file without the UID dataset falls through to num_frames.
- id3c.tests.test_expected_frame_count.test_returns_none_when_no_source(tmp_path)[source]#
No AD file and no num_frames -> None (not an exception).
- id3c.tests.test_expected_frame_count.test_returns_none_when_num_frames_is_none()[source]#
An explicit num_frames=None is treated as absent.
- id3c.tests.test_expected_frame_count.test_never_raises_on_bad_run_object()[source]#
A run object with no usable metadata yields None, not an error.