mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 22:47:43 +02:00
This is part of on-going work with capabilities when working with
tables and able to work with them for data processing & viewing purposes. At the moment, certain ways to process said tables we are able to view a histogram of a given column. As usage matures, we may find certain core commands that could be used ergonomically when working with tables on Nu.
This commit is contained in:
@ -31,6 +31,35 @@ fn group_by() {
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn histogram() {
|
||||
Playground::setup("histogram_test_1", |dirs, sandbox| {
|
||||
sandbox.with_files(vec![FileWithContentToBeTrimmed(
|
||||
"los_tres_caballeros.csv",
|
||||
r#"
|
||||
first_name,last_name,rusty_at
|
||||
Andrés,Robalino,Ecuador
|
||||
Jonathan,Turner,Estados Unidos
|
||||
Yehuda,Katz,Estados Unidos
|
||||
"#,
|
||||
)]);
|
||||
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(), h::pipeline(
|
||||
r#"
|
||||
open los_tres_caballeros.csv
|
||||
| histogram rusty_at countries
|
||||
| where rusty_at == "Ecuador"
|
||||
| get countries
|
||||
| echo $it
|
||||
"#
|
||||
));
|
||||
|
||||
assert_eq!(actual, "**************************************************");
|
||||
// 50%
|
||||
})
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn group_by_errors_if_unknown_column_name() {
|
||||
Playground::setup("group_by_test_2", |dirs, sandbox| {
|
||||
@ -56,7 +85,6 @@ fn group_by_errors_if_unknown_column_name() {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(data_processing_primitives)]
|
||||
#[test]
|
||||
fn split_by() {
|
||||
Playground::setup("split_by_test_1", |dirs, sandbox| {
|
||||
@ -86,7 +114,6 @@ fn split_by() {
|
||||
})
|
||||
}
|
||||
|
||||
#[cfg(data_processing_primitives)]
|
||||
#[test]
|
||||
fn split_by_errors_if_no_table_given_as_input() {
|
||||
Playground::setup("split_by_test_2", |dirs, sandbox| {
|
||||
|
Reference in New Issue
Block a user