Skip to content

Commit

Permalink
fix some tests
Browse files Browse the repository at this point in the history
  • Loading branch information
radeusgd committed Sep 20, 2023
1 parent df80060 commit 9b6b7a6
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions test/Table_Tests/src/In_Memory/Column_Format_Spec.enso
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from Standard.Base import all
import Standard.Base.Errors.Common.Type_Error
import Standard.Base.Errors.Time_Error.Time_Error
import Standard.Base.Errors.Illegal_Argument.Illegal_Argument
import Standard.Base.Data.Time.Date_Time_Formatter.Date_Time_Format_Parse_Error

Expand Down Expand Up @@ -41,7 +42,7 @@ spec =

Test.specify "Bad format" <|
input = Column.from_vector "values" [Date.new 2020 6 21, Date.new 2023 4 25]
input.format "jjjjjj" . should_fail_with Illegal_Argument
input.format "jjjjjj" . should_fail_with Date_Time_Format_Parse_Error

Test.group "Date Column.format, with format Column" <|
Test.specify "Date column" <|
Expand All @@ -66,8 +67,8 @@ spec =

Test.specify "Bad format" <|
input = Column.from_vector "values" [Date.new 2020 6 21, Date.new 2023 4 25, Date.new 2023 4 26]
formats = Column.from_vector "formats" ["yyyyMMdd", "DDDDD", "FFF"]
input.format formats . should_fail_with Illegal_Argument
formats = Column.from_vector "formats" ["yyyyMMdd", "jjjjj", "FFF"]
input.format formats . should_fail_with Date_Time_Format_Parse_Error

Test.specify "Bad format column type" <|
input = Column.from_vector "values" [Date.new 2020 6 21, Date.new 2023 4 25, Date.new 2023 4 26]
Expand All @@ -88,8 +89,8 @@ spec =

Test.specify "Date_Time with locale" <|
input = Column.from_vector "values" [Date_Time.new 2020 6 21 8 10 20, Date_Time.new 2023 4 25 14 25 2]
expected_default = Column.from_vector "values" ["21. June 2020 08.10.20", "25. April 2023 14.25.02"]
expected_gb = Column.from_vector "values" ["21. Jun 2020 08.10.20", "25. Apr 2023 14.25.02"]
expected_default = Column.from_vector "values" ["21. Jun 2020 08.10.20", "25. Apr 2023 14.25.02"]
expected_gb = Column.from_vector "values" ["21. June 2020 08.10.20", "25. April 2023 14.25.02"]
expected_fr = Column.from_vector "values" ["21. juin 2020 08.10.20", "25. avril 2023 14.25.02"]
input.format "d. MMMM yyyy HH.mm.ss" . should_equal expected_default
input.format (Date_Time_Formatter.from "d. MMMM yyyy HH.mm.ss" Locale.default) . should_equal expected_default
Expand Down Expand Up @@ -183,7 +184,7 @@ spec =

Test.specify "Format for wrong date type" <|
input = Column.from_vector "values" [Time_Of_Day.new 8 10 20, Time_Of_Day.new 14 25 2]
input.format "yyyyMMdd HH.mm.ss" . should_fail_with Illegal_Argument
input.format "yyyyMMdd HH.mm.ss" . should_fail_with Time_Error

Test.group "Time_Of_Day Column.format, with format Column" <|
Test.specify "Time_Of_Day column" <|
Expand Down Expand Up @@ -218,8 +219,8 @@ spec =

Test.specify "column length mismatch" <|
input = Column.from_vector "values" [Time_Of_Day.new 8 10 20, Time_Of_Day.new 14 25 2]
formats = Column.from_vector "formats" ["yyyyMMdd", "jjjj", "w"]
input.format formats . should_fail_with Date_Time_Format_Parse_Error
formats = Column.from_vector "formats" ["yyyyMMdd", "jjjjj", "w"]
input.format formats . should_fail_with Illegal_Argument

Test.group "Boolean Column.format, with format string" <|
Test.specify "Boolean column" <|
Expand Down

0 comments on commit 9b6b7a6

Please sign in to comment.