Skip to content

Commit

Permalink
handle #2568 for real
Browse files Browse the repository at this point in the history
  • Loading branch information
romainfrancois committed Oct 1, 2018
1 parent ce3262c commit b742116
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define DPLY_VISITORS_SUBSET_DataFrameSubsetVisitors_H

#include <tools/utils.h>
#include <tools/is_lubridate_unsupported.h>
#include <tools/bad.h>
#include <dplyr/visitors/subset/column_subset.h>

Expand Down
5 changes: 0 additions & 5 deletions inst/include/dplyr/visitors/subset/column_subset.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

#include <tools/utils.h>
#include <tools/set_rownames.h>
#include <tools/is_lubridate_unsupported.h>
#include <tools/bad.h>
#include <tools/default_value.h>
#include <tools/SlicingIndex.h>
Expand Down Expand Up @@ -135,10 +134,6 @@ SEXP column_subset(SEXP x, const Index& index, SEXP env) {
return r_column_subset(x, index, env);
}

if (is_lubridate_unsupported(x)) {
stop("classes Period and Interval from lubridate are currently not supported.") ;
}

switch (TYPEOF(x)) {
case LGLSXP:
return column_subset_impl<LGLSXP, Index>(x, index);
Expand Down
19 changes: 0 additions & 19 deletions inst/include/tools/is_lubridate_unsupported.h

This file was deleted.

14 changes: 5 additions & 9 deletions tests/testthat/test-distinct.R
Original file line number Diff line number Diff line change
Expand Up @@ -167,24 +167,20 @@ test_that("distinct on a dataframe or tibble with columns of type list throws an
)
})

test_that("distinct refuses to deal with Period and Interval from lubridate (#2568)", {
skip("no need for this anymore")
# skip_if_not(requireNamespace("lubridate", quietly = TRUE))
test_that("distinct deals with Period and Interval from lubridate (#2568)", {
skip_if_not(requireNamespace("lubridate", quietly = TRUE))

df <- tibble(
x = lubridate::hm("10:30", "10:30", "0:0"),
y = c("apple", "apple", "tomato")
)
expect_error(distinct(df),
"classes Period and Interval from lubridate are currently not supported"
)
res <- distinct(df)
expect_equal(res, df[c(1, 3), ])

df <- tibble(
lubridate::interval(lubridate::ymd(20090201), lubridate::ymd(20090101))
)
expect_error(distinct(df),
"classes Period and Interval from lubridate are currently not supported"
)
expect_equal(df, distinct(df))
})

test_that("distinct handles 0 columns edge case (#2954)", {
Expand Down

0 comments on commit b742116

Please sign in to comment.