@@ -149,7 +149,7 @@ test_that("filter() and slice() with .preserve = TRUE", {
149149})
150150
151151test_that(" select() and rename()" , {
152- expect_s3_class(select(tourism , Quarter , Region : Purpose ), " tbl_ts" )
152+ expect_s3_class(select(tourism , Region : Purpose ), " tbl_ts" )
153153 expect_s3_class(select(tourism , Quarter : Purpose ), " tbl_ts" )
154154 expect_equal(
155155 quo_name(index(select(tourism , Index = Quarter , Region : Purpose ))),
@@ -166,7 +166,7 @@ test_that("select() and rename()", {
166166 expect_named(select(tourism_mel , - Region ), cols [- 2 ])
167167 expect_named(select(tourism_mel , - State ), cols [- 3 ])
168168 expect_named(select(tourism_mel , - Purpose ), cols [- 4 ])
169- expect_named(select(tourism_mel , Quarter , Trips ), c(" Quarter " , " Trips " ))
169+ expect_named(select(tourism_mel , Trips ), c(" Trips " , " Quarter " ))
170170 expect_named(select(tourism_mel , - Region , - State , - Purpose ), cols [c(1 , 5 )])
171171})
172172
@@ -254,21 +254,21 @@ tsbl <- tsibble(
254254)
255255
256256test_that(" transmute()" , {
257- out <- tourism %> % transmute(Quarter , Region = paste(Region , State ))
257+ out <- tourism %> % transmute(Region = paste(Region , State ))
258258 expect_equal(ncol(out ), 4 )
259- trans_tsbl <- tsbl %> % transmute(qtr , group , z = a / b )
259+ trans_tsbl <- tsbl %> % transmute(z = a / b )
260260 expect_equal(colnames(trans_tsbl ), c(" qtr" , " group" , " z" ))
261261})
262262
263263test_that(" transmute.grouped_ts()" , {
264264 out <- pedestrian %> %
265265 group_by(Time ) %> %
266- transmute(Date_Time )
266+ transmute()
267267 expect_equal(ncol(out ), 3 )
268268 out2 <- pedestrian %> %
269269 group_by_key() %> %
270- transmute(Date_Time )
271- expect_named(out2 , c(" Sensor " , " Date_Time " ))
270+ transmute()
271+ expect_named(out2 , c(" Date_Time " , " Sensor " ))
272272})
273273
274274test_that(" distinct()" , {
@@ -355,33 +355,6 @@ test_that("rename() for renaming key", {
355355 rename(" purpose" = " Purpose" , " region" = " Region" , " trip" = " Trips" )
356356})
357357
358- test_that(" warning when index is automatically re-added #308" , {
359- test_ts <- tsibble(
360- date = as.Date(' 2024-01-01' ) + 0 : 2 ,
361- value = 1 : 3
362- )
363-
364- # select() without index should warn
365- expect_warning(
366- result <- select(test_ts , value ),
367- " Index variable `date` was dropped"
368- )
369- expect_true(" date" %in% names(result ))
370-
371- # transmute() without index should warn
372- expect_warning(
373- result2 <- transmute(test_ts , value2 = value * 2 ),
374- " Index variable `date` was dropped"
375- )
376- expect_true(" date" %in% names(result2 ))
377-
378- # select() with index should not warn
379- expect_no_warning(
380- result3 <- select(test_ts , date , value )
381- )
382- expect_equal(names(result3 ), c(" date" , " value" ))
383- })
384-
385358test_that(" drop redundant key #196" , {
386359 sim_tourism <- tourism %> %
387360 filter(Purpose == " Holiday" ) %> %
0 commit comments