diff --git a/src/exporter/snapshots/annatto__exporter__table__tests__manual_column_ordering_with_id.snap b/src/exporter/snapshots/annatto__exporter__table__tests__manual_column_ordering_with_id.snap new file mode 100644 index 00000000..7c4e827d --- /dev/null +++ b/src/exporter/snapshots/annatto__exporter__table__tests__manual_column_ordering_with_id.snap @@ -0,0 +1,12 @@ +--- +source: src/exporter/table.rs +expression: export.unwrap() +--- +---- test_doc.csv: +norm::pos id_norm::pos annis::tok id_annis::tok dipl::sentence id_dipl::sentence norm::lemma id_norm::lemma norm::norm id_norm::norm dipl::dipl id_dipl::dipl +PRON exmaralda/test_doc#a_norm_T286-T0 exmaralda/test_doc#T286 1 exmaralda/test_doc#a_dipl_T286-T4 I exmaralda/test_doc#a_norm_T286-T0 I exmaralda/test_doc#t_norm_T286-T0 I'm exmaralda/test_doc#t_dipl_T286-T1 +VERB exmaralda/test_doc#a_norm_T0-T1 exmaralda/test_doc#T0 1 exmaralda/test_doc#a_dipl_T286-T4 be exmaralda/test_doc#a_norm_T0-T1 am exmaralda/test_doc#t_norm_T0-T1 I'm exmaralda/test_doc#t_dipl_T286-T1 +ADP exmaralda/test_doc#a_norm_T1-T2 exmaralda/test_doc#T1 1 exmaralda/test_doc#a_dipl_T286-T4 in exmaralda/test_doc#a_norm_T1-T2 in exmaralda/test_doc#t_norm_T1-T2 in exmaralda/test_doc#t_dipl_T1-T2 +PRON exmaralda/test_doc#a_norm_T2-T4 exmaralda/test_doc#T2 1 exmaralda/test_doc#a_dipl_T286-T4 New York exmaralda/test_doc#a_norm_T2-T4 New York exmaralda/test_doc#t_norm_T2-T4 New exmaralda/test_doc#t_dipl_T2-T3 +PRON exmaralda/test_doc#a_norm_T2-T4 exmaralda/test_doc#T3 1 exmaralda/test_doc#a_dipl_T286-T4 New York exmaralda/test_doc#a_norm_T2-T4 New York exmaralda/test_doc#t_norm_T2-T4 York exmaralda/test_doc#t_dipl_T3-T4 + exmaralda/test_doc#T4 diff --git a/src/exporter/table.rs b/src/exporter/table.rs index 214c8fd3..defba84b 100644 --- a/src/exporter/table.rs +++ b/src/exporter/table.rs @@ -659,6 +659,37 @@ mod tests { assert_snapshot!(export.unwrap()); } + #[test] + fn manual_column_ordering_with_id() { + let exmaralda = ImportEXMARaLDA {}; + let mprt = exmaralda.import_corpus( + Path::new("tests/data/import/exmaralda/clean/import/exmaralda/"), + StepID { + module_name: "test_import_exb".to_string(), + path: None, + }, + None, + ); + assert!(mprt.is_ok()); + let mut update_import = mprt.unwrap(); + let g = AnnotationGraph::with_default_graphstorages(true); + assert!(g.is_ok()); + let mut graph = g.unwrap(); + assert!(graph.apply_update(&mut update_import, |_| {}).is_ok()); + let m = ExportTable { + column_names: vec![ + "norm::pos".to_string(), + "annis::tok".to_string(), + "dipl::sentence".to_string(), + ], + id_column: true, + ..Default::default() + }; + let export = export_to_string(&graph, m); + assert!(export.is_ok(), "error: {:?}", export.err()); + assert_snapshot!(export.unwrap()); + } + #[test] fn no_id_column() { let exmaralda = ImportEXMARaLDA {};