Skip to content

Commit 42cc928

Browse files
committed
Report unobservable features on export
1 parent dda273e commit 42cc928

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

‎src/openstatspec/spss/sav.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def _import_loss_report(meta: Any) -> tuple[dict[str, str], ...]:
146146

147147

148148
def _export_loss_report(dataset: dict[str, Any], variables: list[dict[str, Any]]) -> tuple[dict[str, str], ...]:
149-
events = []
149+
events = [{"code": "unobservable-source-dictionary-features", "detail": "Variable sets and custom file/variable attributes are not observable through the reader and therefore cannot be restored by export."}]
150150
if dataset["multiple_response_sets"] != "{}":
151151
events.append({"code": "multiple-response-sets-not-exported", "detail": "The SAV writer has no multiple-response-set output capability."})
152152
if any(item.get("alignment") not in (None, "unknown") for item in variables):

‎tests/test_loss_reports.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,5 +26,5 @@ def test_export_reports_unwritable_spss_dictionary_features(tmp_path) -> None:
2626
connection = sqlite3.connect(tmp_path / "dataset.sqlite")
2727
assert connection.execute("select set_name, member_ordinal, variable_name from multiple_response_set_catalog").fetchall() == [("set1", 1, None)]
2828
assert {event["code"] for event in result["loss_report"]} == {
29-
"multiple-response-sets-not-exported", "variable-alignment-not-exported"
29+
"multiple-response-sets-not-exported", "variable-alignment-not-exported", "unobservable-source-dictionary-features"
3030
}

0 commit comments

Comments
 (0)