Skip to content

Commit

Permalink
Also test column order when ID is enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaskrause committed Oct 9, 2024
1 parent c892248 commit 1f8fcf5
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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
31 changes: 31 additions & 0 deletions src/exporter/table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {};
Expand Down

0 comments on commit 1f8fcf5

Please sign in to comment.