-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Date vs string
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# spaceship(<date> <=> <string>) | ||
|
||
Code | ||
spaceship_rfuns(as.Date("2024-03-21"), "not a date", "==") | ||
Condition | ||
Error in `map()`: | ||
i In index: 1. | ||
i With name: x. | ||
Caused by error: | ||
! Error evaluating duckdb query: Conversion Error: date field value out of range: "not a date", expected format is (YYYY-MM-DD) | ||
|
||
--- | ||
|
||
Code | ||
spaceship_r(as.Date("2024-03-21"), "not a date", "==") | ||
Condition | ||
Error in `map()`: | ||
i In index: 1. | ||
i With name: ==. | ||
Caused by error in `charToDate()`: | ||
! character string is not in a standard unambiguous format | ||
|
||
# spaceship(<time> <=> <string>) | ||
|
||
Code | ||
spaceship_rfuns(time, time_chr_gibberish, "==") | ||
Condition | ||
Error in `map()`: | ||
i In index: 1. | ||
i With name: x. | ||
Caused by error: | ||
! Error evaluating duckdb query: Conversion Error: timestamp field value "2024-02-21 14:00:00 gibberish" has a timestamp that is not UTC. | ||
Use the TIMESTAMPTZ type with the ICU extension loaded to handle non-UTC timestamps. | ||
|
||
--- | ||
|
||
Code | ||
spaceship_rfuns(as.POSIXct(strptime("2024-02-21 14:00:00", format = "%Y-%m-%d %H:%M:%S")), | ||
"not a time", "==") | ||
Condition | ||
Error in `map()`: | ||
i In index: 1. | ||
i With name: x. | ||
Caused by error: | ||
! Error evaluating duckdb query: Conversion Error: timestamp field value out of range: "not a time", expected format is (YYYY-MM-DD HH:MM:SS[.US][±HH:MM| ZONE]) | ||
|
||
--- | ||
|
||
Code | ||
spaceship_r(as.POSIXct(strptime("2024-02-21 14:00:00", format = "%Y-%m-%d %H:%M:%S")), | ||
"not a time", "==") | ||
Condition | ||
Error in `map()`: | ||
i In index: 1. | ||
i With name: ==. | ||
Caused by error in `as.POSIXlt.character()`: | ||
! character string is not in a standard unambiguous format | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,26 @@ | ||
expect_spaceship <- function(x, y) { | ||
expect_equal( | ||
|
||
ok_rfuns <- ok_r <- TRUE | ||
|
||
rfuns <- tryCatch( | ||
spaceship_rfuns(x, y, keep.data = FALSE), | ||
spaceship_r(x, y, keep.data = FALSE) | ||
error = function(err) { | ||
ok_rfuns <<- FALSE | ||
} | ||
) | ||
|
||
r <- tryCatch( | ||
spaceship_r(x, y, keep.data = FALSE), | ||
error = function(err) { | ||
ok_r <<- FALSE | ||
} | ||
) | ||
|
||
expect_equal(ok_r, ok_rfuns, info = "<=> should either pass for both or fail for both") | ||
|
||
if (ok_r && ok_rfuns) { | ||
expect_equal(rfuns, r) | ||
} | ||
|
||
} | ||
|