ewoksxas.converters.tests.test_orange#
Tests for the Converter class.
Functions
Test that 1D feature_data is reshaped to 2D. |
|
Test adding features for the first time. |
|
Test that a second call replaces the existing feature block. |
|
Test that shape mismatch raises ValueError. |
|
Test adding features then metas. |
|
Test that add_meta adds a new column when the name is unknown. |
|
Non-numeric metadata with few unique values is auto-detected discrete. |
|
At most MAX_DISCRETE_VALUES unique -> discrete, otherwise string. |
|
Test that an explicit var_type converts a categorical column to text. |
|
DiscreteVariable is now accepted for metas. |
|
|
Numeric data replacing a carried categorical column becomes continuous. |
|
Numeric data replacing a carried text column becomes continuous. |
Numeric metadata is inferred as ContinuousVariable, data untouched. |
|
Test that replacing a column reuses its existing variable type. |
|
Test that add_meta replaces an existing column without reordering. |
|
A meta whose length differs from the existing rows is rejected. |
|
A scalar meta on a non-empty converter raises ValueError, not IndexError. |
|
Non-numeric data still inherits the type of the replaced column. |
|
Continuous, string, and discrete metas are carried over unchanged. |
|
overwrite=True replaces the existing same-named meta in place. |
|
Carrying metas from a source with a different row count raises. |
|
A same-named meta already present is kept, not overwritten. |
|
Test adding metas then features. |
|
add_target replaces an existing same-named target instead of appending. |
|
A target whose length differs from the existing rows is rejected. |
|
StringVariable is not a valid target type. |
|
A non-numeric target with too many unique values cannot be inferred. |
|
Test that mismatched metadata columns cannot be concatenated. |
|
Discrete columns with differing categories merge into a new column. |
|
Test concatenating DiscreteVariable targets with matching values. |
|
Test that concatenating an empty sequence raises. |
|
Test that a converter with extra columns cannot be concatenated. |
|
Test that mismatched feature x-axes cannot be concatenated. |
|
Test that mixing feature-less and featured converters raises. |
|
Test stacking two converters row-wise. |
|
Test that converters with string feature names can be concatenated. |
|
Test that Converter can be initialized empty. |
|
Test the features property returns correct tuple. |
|
Test that features property raises error when no features set. |
|
get_meta_row returns decoded per-spectrum values keyed by meta name. |
|
A per-row default is used verbatim, for both lists and arrays. |
|
A scalar default is broadcast to one value per row. |
|
A missing meta without a default raises KeyError. |
|
A non-scalar default with the wrong length raises instead of truncating. |
|
get_group_id accepts user-chosen hash columns on demand (2+ supported). |
|
A table without the hash columns leaves hash_id None (callers use .ids). |
|
The same (Filename, Scan Name) hashes identically in separate tables. |
|
from_table hashes each row by (Filename, Scan Name), content-based. |
|
Test that meta_names lists metadata columns in order. |
|
meta_values on a continuous meta returns the numeric array unchanged. |
|
The metas property exposes Column objects with attribute access. |
|
Row count comes from features, then metas, then targets. |
|
Test round-trip conversion: Converter -> Table -> Converter. |
|
A discrete meta survives to_table -> from_table as its labels. |
|
Features and continuous metas survive to_table -> from_table. |
|
A string feature axis that parses as numbers survives two round trips. |
|
Verify that every row has a unique id handled natively by orange. |
|
Targets and metas end up in the expected domain slots. |
|
Test that a row index may be repeated. |
|
Test that selecting zero rows yields an empty but valid table. |
|
Test that mutating a selection does not affect the source. |
|
Test that targets are subset alongside features. |
|
Test selecting a subset of rows in a new order. |
|
Test that take_rows subsets an auto-detected categorical meta. |
|
Test that take_rows preserves (and isolates) DiscreteVariable values. |
|
Test creating an empty table. |
|
Test creating a table with features only. |
|
Test creating a table with metas only. |
|
with_features() returns a new Converter with new features and the metas. |
|
with_features() rejects data that does not have one row per source row. |
|
Task-computed metas added after with_features() replace carried ones in place. |