Skip to content

all_args_have_default_values and NULL default parameters #171

Closed

Description

@dernst

I have a driver constructor of this form:

foo = function(driverclass=NULL, classpath=NULL) {
#...
new("foo")
}

which gives the following error when trying to run the tests:

> DBItest::test_all(skip=c("package_name", NULL))
Error: Test failed: 'DBItest: Driver: constructor'
* values must be length 1,
 but FUN(X[[1]]) result is length 0
1: expect_warning(expect_that(constructor, all_args_have_default_values()), NA)
2: quasi_capture(enquo(object), capture_warnings, label = label)
3: capture(act$val <- eval_bare(get_expr(quo), get_env(quo)))
4: withCallingHandlers(code, warning = function(condition) {
       out$push(condition)
       invokeRestart("muffleWarning")
   })
5: eval_bare(get_expr(quo), get_env(quo))
6: expect_that(constructor, all_args_have_default_values())
7: condition(object)
8: expect_true(all(vapply(args, as.character, character(1L)) != ""), "has arguments without default values")
9: quasi_label(enquo(object), label)
10: eval_bare(get_expr(quo), get_env(quo))
11: vapply(args, as.character, character(1L))

Are NULL default parameters not allowed for driver constructors in DBI? The error seems to occur in vapply, the analogous statement with lapply seems to give the expected result.
Thanks.

Activity

  1. krlmlr commented on Aug 26, 2018

    @krlmlr
    Member

    Thanks for reporting!

  2. locked and limited conversation to collaborators on Dec 5, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions