Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Place useFancyQuotes setting in test.data.table #6783

Merged
merged 1 commit into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions R/test.data.table.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,13 @@ test.data.table = function(script="tests.Rraw", verbose=FALSE, pkg=".", silent=F
scipen = 0L, # fwrite now respects scipen
datatable.optimize = Inf,
datatable.alloccol = 1024L,
datatable.print.class = FALSE, # output= tests were written when default was FALSE
datatable.print.keys = FALSE, # output= tests were written when default was FALSE
datatable.print.class = FALSE, # many old output= tests were written when default was FALSE
datatable.print.keys = FALSE, # many old output= tests were written when default was FALSE
datatable.print.trunc.cols = FALSE, #4552
datatable.rbindlist.check = NULL,
datatable.integer64 = "integer64",
digits = 7L, # ensure printing rounds to the expected number of digits in all sessions, #5285
useFancyQuotes = FALSE, # otherwise we get angled quotes, hard to match robustly
warn = 0L, # ensure signals are emitted as they are in the code, #5285
warnPartialMatchArgs = base::getRversion()>="3.6.0", # ensure we don't rely on partial argument matching in internal code, #3664; >=3.6.0 for #3865
warnPartialMatchAttr = TRUE,
Expand Down
7 changes: 2 additions & 5 deletions inst/tests/tests.Rraw
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,6 @@ TZnotUTC = !identical(tt,"") && !is_utc(tt)
# (3) function factory for matching messages exactly by substituting anything between delimiters [delim, fmt=TRUE]
# (4) function factory for matching messages exactly by substituting a generic string [fmt=string]
get_msg = function(e, delim, fmt=FALSE) {
ufq = options(useFancyQuotes = FALSE) # otherwise we get angled quotes, hard to match robustly
on.exit(options(ufq))

condition = tryCatch({e; NULL}, error=identity, warning=identity)
if (is.null(condition)) return(condition)
msg = condition$message
Expand Down Expand Up @@ -10994,7 +10991,7 @@ DT = data.table(
D = as.POSIXct(dt<-paste(d,t), tz="UTC"),
E = as.POSIXct(paste0(dt,c(".999",".0",".5",".111112",".123456",".023",".0",".999999",".99",".0009")), tz="UTC"))

test(1740.1, options=c(useFancyQuotes=FALSE), fwrite(DT,dateTimeAs="iso"),
test(1740.1, fwrite(DT,dateTimeAs="iso"),
error=base_messages$match_arg_4_choices("ISO", "squash", "epoch", "write.csv"))
test(1740.2, fwrite(DT,dateTimeAs=c("ISO","squash")), error=base_messages$match_arg_length)
test(1740.3, capture.output(fwrite(DT,dateTimeAs="ISO")), c(
Expand Down Expand Up @@ -11106,7 +11103,7 @@ test(1743.123, fread("a,b\n1+3i,2015-01-01", colClasses=c(NA,"IDate")), data.tab
test(1743.13, lapply(fread("a,b\n09/05/98,2015-01-01", colClasses = "Date"), class), y=list(a="character", b=c("IDate", "Date")), warning=base_messages$ambiguous_date_fmt)

## Just invalid
test(1743.14, options = c(useFancyQuotes = FALSE),
test(1743.14,
sapply(fread("a,b\n2017-01-01,1", colClasses=c("foo", "integer")), class), c(a="character", b="integer"),
warning=base_messages$missing_coerce_method)
test(1743.15, sapply(fread("a,b\n2017-01-01,1", colClasses=c("foo", "integer")), class), c(a="character", b="integer"), warning="the column has been left as type .*character")
Expand Down
Loading