Skip to content

Commit 32dfd8d

Browse files
Place useFancyQuotes setting in test.data.table (#6783)
1 parent d0887df commit 32dfd8d

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

R/test.data.table.R

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,12 +95,13 @@ test.data.table = function(script="tests.Rraw", verbose=FALSE, pkg=".", silent=F
9595
scipen = 0L, # fwrite now respects scipen
9696
datatable.optimize = Inf,
9797
datatable.alloccol = 1024L,
98-
datatable.print.class = FALSE, # output= tests were written when default was FALSE
99-
datatable.print.keys = FALSE, # output= tests were written when default was FALSE
98+
datatable.print.class = FALSE, # many old output= tests were written when default was FALSE
99+
datatable.print.keys = FALSE, # many old output= tests were written when default was FALSE
100100
datatable.print.trunc.cols = FALSE, #4552
101101
datatable.rbindlist.check = NULL,
102102
datatable.integer64 = "integer64",
103103
digits = 7L, # ensure printing rounds to the expected number of digits in all sessions, #5285
104+
useFancyQuotes = FALSE, # otherwise we get angled quotes, hard to match robustly
104105
warn = 0L, # ensure signals are emitted as they are in the code, #5285
105106
warnPartialMatchArgs = base::getRversion()>="3.6.0", # ensure we don't rely on partial argument matching in internal code, #3664; >=3.6.0 for #3865
106107
warnPartialMatchAttr = TRUE,

inst/tests/tests.Rraw

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -159,9 +159,6 @@ TZnotUTC = !identical(tt,"") && !is_utc(tt)
159159
# (3) function factory for matching messages exactly by substituting anything between delimiters [delim, fmt=TRUE]
160160
# (4) function factory for matching messages exactly by substituting a generic string [fmt=string]
161161
get_msg = function(e, delim, fmt=FALSE) {
162-
ufq = options(useFancyQuotes = FALSE) # otherwise we get angled quotes, hard to match robustly
163-
on.exit(options(ufq))
164-
165162
condition = tryCatch({e; NULL}, error=identity, warning=identity)
166163
if (is.null(condition)) return(condition)
167164
msg = condition$message
@@ -10994,7 +10991,7 @@ DT = data.table(
1099410991
D = as.POSIXct(dt<-paste(d,t), tz="UTC"),
1099510992
E = as.POSIXct(paste0(dt,c(".999",".0",".5",".111112",".123456",".023",".0",".999999",".99",".0009")), tz="UTC"))
1099610993

10997-
test(1740.1, options=c(useFancyQuotes=FALSE), fwrite(DT,dateTimeAs="iso"),
10994+
test(1740.1, fwrite(DT,dateTimeAs="iso"),
1099810995
error=base_messages$match_arg_4_choices("ISO", "squash", "epoch", "write.csv"))
1099910996
test(1740.2, fwrite(DT,dateTimeAs=c("ISO","squash")), error=base_messages$match_arg_length)
1100010997
test(1740.3, capture.output(fwrite(DT,dateTimeAs="ISO")), c(
@@ -11106,7 +11103,7 @@ test(1743.123, fread("a,b\n1+3i,2015-01-01", colClasses=c(NA,"IDate")), data.tab
1110611103
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)
1110711104

1110811105
## Just invalid
11109-
test(1743.14, options = c(useFancyQuotes = FALSE),
11106+
test(1743.14,
1111011107
sapply(fread("a,b\n2017-01-01,1", colClasses=c("foo", "integer")), class), c(a="character", b="integer"),
1111111108
warning=base_messages$missing_coerce_method)
1111211109
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")

0 commit comments

Comments
 (0)