← Về thư mục
tests/flowio/test_scripts.py
- write_fcs · function · L49-L60 — def write_fcs( path: Path, events: list[float], channels: list[str], optional: list[str] | None = None, ) -> Path
- namespace · function · L63-L82 — def namespace(**overrides) -> argparse.Namespace
- ArgumentValidatorTests · class · L85-L107 — class ArgumentValidatorTests(unittest.TestCase)
- test_nonnegative_int_admits_zero_because_zero_disables_a_limit · method · L86-L89 — def test_nonnegative_int_admits_zero_because_zero_disables_a_limit(self) -> None: # --max-bytes 0 is documented as "no ceiling", so zero must parse.
- test_nonnegative_int_refuses_a_negative_ceiling · method · L91-L93 — def test_nonnegative_int_refuses_a_negative_ceiling(self) -> None
- test_positive_int_refuses_zero_and_below · method · L95-L101 — def test_positive_int_refuses_zero_and_below(self) -> None: # --max-datasets 0 would make the dataset walk yield nothing at all.
- test_non_numeric_limits_raise · method · L103-L107 — def test_non_numeric_limits_raise(self) -> None
- FcsFileTestCase · class · L110-L114 — class FcsFileTestCase(unittest.TestCase)
- setUp · method · L111-L114 — def setUp(self) -> None
- ChannelClassificationTests · class · L117-L161 — class ChannelClassificationTests(FcsFileTestCase)
- flow · method · L122-L129 — def flow(self, null: list[str] | None = None)
- test_scatter_time_and_fluorescence_are_told_apart · method · L131-L134 — def test_scatter_time_and_fluorescence_are_told_apart(self) -> None
- test_a_declared_null_channel_outranks_its_detected_kind · method · L136-L143 — def test_a_declared_null_channel_outranks_its_detected_kind(self) -> None: # --null-channel exists to retire a channel; if the kind still said # "fluorescence" the column would keep being analysed.
- test_channel_records_number_parameters_from_one · method · L145-L152 — def test_channel_records_number_parameters_from_one(self) -> None: # FCS $PnN keywords are 1-based; the numpy column index is 0-based. # Conflating them shifts every reported gain and range by one channel.
- test_channel_records_carry_the_scaling_keywords_as_json_types · method · L154-L161 — def test_channel_records_carry_the_scaling_keywords_as_json_types(self) -> None: # $PnE is a tuple in FlowIO; JSON cannot hold a tuple, so the record # must convert it -- otherwise
write_report fails on real files.
- FiniteStatisticsTests · class · L164-L213 — class FiniteStatisticsTests(unittest.TestCase)
- setUp · method · L177-L178 — def setUp(self) -> None
- test_one_record_is_emitted_per_channel_in_order · method · L180-L182 — def test_one_record_is_emitted_per_channel_in_order(self) -> None
- test_statistics_are_computed_over_the_finite_values_only · method · L184-L191 — def test_statistics_are_computed_over_the_finite_values_only(self) -> None
- test_infinities_are_counted_by_sign_and_excluded_from_the_range · method · L193-L198 — def test_infinities_are_counted_by_sign_and_excluded_from_the_range(self) -> None
- test_a_channel_with_no_finite_value_reports_none_not_nan · method · L200-L207 — def test_a_channel_with_no_finite_value_reports_none_not_nan(self) -> None: # json.dumps(..., allow_nan=False) in write_report rejects NaN, so the # statistics must degrade to null rather than to a NaN float.
- test_a_fully_finite_channel_keeps_every_event · method · L209-L213 — def test_a_fully_finite_channel_keeps_every_event(self) -> None
- FakeText · class · L216-L217 — class FakeText(dict)
- FakeFlow · class · L220-L222 — class FakeFlow
- init · method · L221-L222 — def init(self, nextdata: str) -> None
- DatasetWalkTests · class · L225-L289 — class DatasetWalkTests(FcsFileTestCase)
- setUp · method · L228-L231 — def setUp(self) -> None
- walk · method · L233-L253 — def walk(self, nextdata_values: list[str], max_datasets: int = 8)
- fake_flow_data · function · L238-L240 — def fake_flow_data(path, **kwargs)
- test_a_single_dataset_file_stops_after_one · method · L255-L260 — def test_a_single_dataset_file_stops_after_one(self) -> None
- test_nextdata_is_relative_so_offsets_accumulate · method · L262-L268 — def test_nextdata_is_relative_so_offsets_accumulate(self) -> None: # FCS $NEXTDATA is relative to the start of the current dataset. Two # hops of 100 must land at 100 then 200, not 100 twice.
- test_a_negative_relative_offset_is_refused · method · L270-L274 — def test_a_negative_relative_offset_is_refused(self) -> None
- test_an_offset_past_the_end_of_the_file_is_refused · method · L276-L281 — def test_an_offset_past_the_end_of_the_file_is_refused(self) -> None: # The file is 1000 bytes; seeking to 5000 would read foreign memory.
- test_the_dataset_count_ceiling_is_enforced · method · L283-L289 — def test_the_dataset_count_ceiling_is_enforced(self) -> None: # A chain of 10-byte hops never terminates on its own; --max-datasets # is the only thing that stops it.
- InspectFileTests · class · L292-L393 — class InspectFileTests(FcsFileTestCase)
- setUp · method · L295-L302 — def setUp(self) -> None
- test_the_report_describes_the_file_that_was_written · method · L304-L312 — def test_the_report_describes_the_file_that_was_written(self) -> None
- test_the_array_estimate_is_events_times_channels_times_eight · method · L314-L318 — def test_the_array_estimate_is_events_times_channels_times_eight(self) -> None: # float64 is 8 bytes; this estimate is what --max-array-bytes compares # against, so an understated one defeats the ceiling.
- test_metadata_only_is_the_default_and_says_so · method · L320-L325 — def test_metadata_only_is_the_default_and_says_so(self) -> None
- test_stats_loads_events_and_reports_the_array_shape · method · L327-L334 — def test_stats_loads_events_and_reports_the_array_shape(self) -> None
- test_raw_stats_are_labelled_as_encoded_values · method · L336-L342 — def test_raw_stats_are_labelled_as_encoded_values(self) -> None: # The semantics string is how a reader knows whether gain/log scaling # was applied; mislabelling it invalidates every downstream comparison.
- test_text_and_analysis_are_withheld_unless_requested · method · L344-L352 — def test_text_and_analysis_are_withheld_unless_requested(self) -> None: # TEXT can carry patient identifiers, so it is opt-in.
- test_a_file_over_the_byte_ceiling_is_refused_before_parsing · method · L354-L356 — def test_a_file_over_the_byte_ceiling_is_refused_before_parsing(self) -> None
- test_a_zero_byte_ceiling_disables_the_check · method · L358-L360 — def test_a_zero_byte_ceiling_disables_the_check(self) -> None
- test_the_array_ceiling_only_applies_with_stats · method · L362-L368 — def test_the_array_ceiling_only_applies_with_stats(self) -> None: # Metadata-only inspection allocates no array, so a tiny ceiling must # not block it -- and must block --stats.
- test_a_ceiling_equal_to_the_estimate_is_accepted · method · L370-L375 — def test_a_ceiling_equal_to_the_estimate_is_accepted(self) -> None: # The comparison is strictly-greater, so the boundary must pass.
- test_a_missing_input_raises_file_not_found · method · L377-L379 — def test_a_missing_input_raises_file_not_found(self) -> None
- test_a_directory_is_not_a_regular_file · method · L381-L383 — def test_a_directory_is_not_a_regular_file(self) -> None
- test_the_checksum_is_opt_in_and_matches_the_streaming_helper · method · L385-L389 — def test_the_checksum_is_opt_in_and_matches_the_streaming_helper(self) -> None
- test_the_checksum_matches_hashlib_on_the_same_bytes · method · L391-L393 — def test_the_checksum_matches_hashlib_on_the_same_bytes(self) -> None
- ReportWritingTests · class · L396-L414 — class ReportWritingTests(FcsFileTestCase)
- test_stdout_receives_parseable_json · method · L397-L401 — def test_stdout_receives_parseable_json(self) -> None
- test_an_existing_output_file_is_never_overwritten · method · L403-L408 — def test_an_existing_output_file_is_never_overwritten(self) -> None
- test_a_non_finite_number_is_refused_rather_than_written_as_nan · method · L410-L414 — def test_a_non_finite_number_is_refused_rather_than_written_as_nan(self) -> None: # Bare NaN is not valid JSON; writing it would produce a file that # every conforming parser rejects.
- MainTests · class · L417-L454 — class MainTests(FcsFileTestCase)
- setUp · method · L418-L420 — def setUp(self) -> None
- test_a_clean_run_exits_zero_and_writes_the_requested_file · method · L422-L426 — def test_a_clean_run_exits_zero_and_writes_the_requested_file(self) -> None
- test_raw_without_stats_is_rejected_by_the_parser · method · L428-L433 — def test_raw_without_stats_is_rejected_by_the_parser(self) -> None: # --raw only changes how events are decoded, so it is meaningless # without --stats; accepting it would silently do nothing.
- test_writing_the_report_over_the_input_fcs_is_rejected · method · L435-L440 — def test_writing_the_report_over_the_input_fcs_is_rejected(self) -> None
- test_a_missing_input_exits_two_with_a_message_not_a_traceback · method · L442-L448 — def test_a_missing_input_exits_two_with_a_message_not_a_traceback(self) -> None
- test_a_file_that_is_not_fcs_at_all_exits_two · method · L450-L454 — def test_a_file_that_is_not_fcs_at_all_exits_two(self) -> None