Skip to content

Commit

Permalink
fix after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Apr 21, 2023
1 parent 2d22032 commit d13e799
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/Table_Tests/src/Common_Table_Operations/Aggregate_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -1436,6 +1436,22 @@ spec setup =
err.should_fail_with Invalid_Value_Type
err.catch.related_column.should_equal "Int"

Test.specify "should return predictable types" <|
table = table_builder [["Text", ["a", "b"]], ["Int", [1, 2]], ["Float", [1.1, 2.2]]]

t1 = table.aggregate [Group_By "Text", Group_By "Int", Group_By "Float"]
t1.at "Text" . value_type . is_text . should_be_true
t1.at "Int" . value_type . is_integer . should_be_true
t1.at "Float" . value_type . is_floating_point . should_be_true

t2 = table.aggregate [Count, Count_Not_Empty "Text", Sum "Int", Sum "Float", Average "Int", Concatenate "Text"]
t2.at "Count" . value_type . is_integer . should_be_true
t2.at "Count Not Empty Text" . value_type . is_integer . should_be_true
t2.at "Sum Int" . value_type . is_numeric . should_be_true
t2.at "Sum Float" . value_type . is_floating_point . should_be_true
t2.at "Average Int" . value_type . is_floating_point . should_be_true
t2.at "Concatenate Text" . value_type . is_text . should_be_true

Test.group prefix+"Table.aggregate should raise warnings when there are issues computing aggregation" pending=(resolve_pending test_selection.aggregation_problems) <|
table =
col1 = ["Index", [1, 2, 3]]
Expand Down
15 changes: 15 additions & 0 deletions test/Table_Tests/src/Common_Table_Operations/Cross_Tab_Spec.enso
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,21 @@ spec setup =
t3 = t.cross_tab [] "Key" values=[Concatenate "ints"] on_problems=pb
t3.should_fail_with Invalid_Value_Type

Test.specify "should return predictable types" <|
table = table_builder [["Text", ["a", "b"]], ["Int", [1, 2]], ["Float", [1.1, 2.2]]]
t1 = table.cross_tab ["Int"] "Text"
t1.column_names . should_equal ["Int", "a", "b"]
t1.at "Int" . value_type . is_integer . should_be_true
t1.at "a" . value_type . is_integer . should_be_true
t1.at "b" . value_type . is_integer . should_be_true

t2 = table.cross_tab [] "Int" values=[Average "Float", Concatenate "Text"] . sort_columns
t2.column_names . should_equal ["1 Average Float", "1 Concatenate Text", "2 Average Float", "2 Concatenate Text"]
t2.at "1 Average Float" . value_type . is_floating_point . should_be_true
t2.at "1 Concatenate Text" . value_type . is_text . should_be_true
t2.at "2 Average Float" . value_type . is_floating_point . should_be_true
t2.at "2 Concatenate Text" . value_type . is_text . should_be_true

Test.specify "should fail gracefully if an effective column name would contain invalid characters" <|
table = table_builder [["Key", ['x', 'x', 'y\0', '\0', 'y\0', 'z', 'z', 'z', 'z']], ["Value", [1, 2, 3, 4, 5, 6, 7, 8, 9]]]
r1 = table.cross_tab
Expand Down

0 comments on commit d13e799

Please sign in to comment.