ewoksxas.converters.tests.test_orange#

Tests for the Converter class.

Functions

test_add_features_1d_data()

Test that 1D feature_data is reshaped to 2D.

test_add_features_first_call()

Test adding features for the first time.

test_add_features_overwrites()

Test that a second call replaces the existing feature block.

test_add_features_shape_mismatch()

Test that shape mismatch raises ValueError.

test_add_features_then_metas()

Test adding features then metas.

test_add_meta_adds_when_absent()

Test that add_meta adds a new column when the name is unknown.

test_add_meta_autodetect_discrete()

Non-numeric metadata with few unique values is auto-detected discrete.

test_add_meta_autodetect_threshold()

At most MAX_DISCRETE_VALUES unique -> discrete, otherwise string.

test_add_meta_changes_discrete_to_string()

Test that an explicit var_type converts a categorical column to text.

test_add_meta_explicit_discrete_now_allowed()

DiscreteVariable is now accepted for metas.

test_add_meta_numeric_replacement_of_discrete_becomes_continuous()

Numeric data replacing a carried categorical column becomes continuous.

test_add_meta_numeric_replacement_of_string_becomes_continuous()

Numeric data replacing a carried text column becomes continuous.

test_add_meta_numeric_stays_continuous()

Numeric metadata is inferred as ContinuousVariable, data untouched.

test_add_meta_preserves_continuous_type()

Test that replacing a column reuses its existing variable type.

test_add_meta_replaces_in_place()

Test that add_meta replaces an existing column without reordering.

test_add_meta_row_count_mismatch_raises()

A meta whose length differs from the existing rows is rejected.

test_add_meta_scalar_raises_value_error()

A scalar meta on a non-empty converter raises ValueError, not IndexError.

test_add_meta_string_replacement()

Non-numeric data still inherits the type of the replaced column.

test_add_metas_from_copies_all_types()

Continuous, string, and discrete metas are carried over unchanged.

test_add_metas_from_overwrite()

overwrite=True replaces the existing same-named meta in place.

test_add_metas_from_row_mismatch_raises()

Carrying metas from a source with a different row count raises.

test_add_metas_from_skips_existing_by_default()

A same-named meta already present is kept, not overwritten.

test_add_metas_then_features()

Test adding metas then features.

test_add_target_replaces_in_place()

add_target replaces an existing same-named target instead of appending.

test_add_target_row_count_mismatch_raises()

A target whose length differs from the existing rows is rejected.

test_add_target_string_rejected()

StringVariable is not a valid target type.

test_add_target_too_many_categories()

A non-numeric target with too many unique values cannot be inferred.

test_concatenate_column_mismatch_raises()

Test that mismatched metadata columns cannot be concatenated.

test_concatenate_discrete_reinfers_values()

Discrete columns with differing categories merge into a new column.

test_concatenate_discrete_targets()

Test concatenating DiscreteVariable targets with matching values.

test_concatenate_empty_raises()

Test that concatenating an empty sequence raises.

test_concatenate_extra_column_raises()

Test that a converter with extra columns cannot be concatenated.

test_concatenate_feature_mismatch_raises()

Test that mismatched feature x-axes cannot be concatenated.

test_concatenate_mixed_none_features_raises()

Test that mixing feature-less and featured converters raises.

test_concatenate_rows()

Test stacking two converters row-wise.

test_concatenate_string_feature_names()

Test that converters with string feature names can be concatenated.

test_empty_initialization()

Test that Converter can be initialized empty.

test_features_property()

Test the features property returns correct tuple.

test_features_property_empty()

Test that features property raises error when no features set.

test_get_meta_row()

get_meta_row returns decoded per-spectrum values keyed by meta name.

test_get_meta_values_missing_per_row_default()

A per-row default is used verbatim, for both lists and arrays.

test_get_meta_values_missing_scalar_default_broadcasts()

A scalar default is broadcast to one value per row.

test_get_meta_values_missing_without_default_raises()

A missing meta without a default raises KeyError.

test_get_meta_values_wrong_length_default_raises()

A non-scalar default with the wrong length raises instead of truncating.

test_hash_id_custom_columns()

get_group_id accepts user-chosen hash columns on demand (2+ supported).

test_hash_id_none_when_columns_missing()

A table without the hash columns leaves hash_id None (callers use .ids).

test_hash_id_stable_across_tables()

The same (Filename, Scan Name) hashes identically in separate tables.

test_hash_id_unique_per_filename_scan_pair()

from_table hashes each row by (Filename, Scan Name), content-based.

test_is_compatible()

test_meta_names()

Test that meta_names lists metadata columns in order.

test_meta_values_continuous_returns_numbers()

meta_values on a continuous meta returns the numeric array unchanged.

test_metas_property_returns_columns()

The metas property exposes Column objects with attribute access.

test_n_rows_source_priority()

Row count comes from features, then metas, then targets.

test_role_as_enum()

test_round_trip()

Test round-trip conversion: Converter -> Table -> Converter.

test_round_trip_discrete_meta()

A discrete meta survives to_table -> from_table as its labels.

test_round_trip_features_and_metas()

Features and continuous metas survive to_table -> from_table.

test_round_trip_numeric_looking_string_features()

A string feature axis that parses as numbers survives two round trips.

test_table_unique_id()

Verify that every row has a unique id handled natively by orange.

test_table_with_target_and_metas()

Targets and metas end up in the expected domain slots.

test_take_rows_duplicate()

Test that a row index may be repeated.

test_take_rows_empty()

Test that selecting zero rows yields an empty but valid table.

test_take_rows_isolation()

Test that mutating a selection does not affect the source.

test_take_rows_preserves_targets()

Test that targets are subset alongside features.

test_take_rows_subset_and_reorder()

Test selecting a subset of rows in a new order.

test_take_rows_with_discrete_meta()

Test that take_rows subsets an auto-detected categorical meta.

test_take_rows_with_discrete_target()

Test that take_rows preserves (and isolates) DiscreteVariable values.

test_to_table_empty()

Test creating an empty table.

test_to_table_features_only()

Test creating a table with features only.

test_to_table_metas_only()

Test creating a table with metas only.

test_vartype_as_enum()

test_vartype_from_label()

test_vartype_infer()

test_vartype_labels()

test_with_features_carries_metas()

with_features() returns a new Converter with new features and the metas.

test_with_features_row_mismatch_raises()

with_features() rejects data that does not have one row per source row.

test_with_features_then_add_meta_replaces_carried()

Task-computed metas added after with_features() replace carried ones in place.