Skip to content

Commit

Permalink
collection: fix naming bug
Browse files Browse the repository at this point in the history
  • Loading branch information
berndbischl committed Feb 7, 2019
1 parent 6874f19 commit c7f3cb7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
1 change: 1 addition & 0 deletions R/ParamSetCollection.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ ParamSetCollection = R6Class("ParamSetCollection", inherit = ParamSet,
assert_names(setids, type = "unique")
if (any(map_lgl(sets, "has_trafo"))) # we need to be able to have a trafo on the collection, not sure how to mix this with individual trafos yet.
stop("Building a collection out sets, where a ParamSet has a trafo is currently unsupported!")
names(sets) = NULL # we drop names here, otherwise a problem happens when we unlist in AB "params"
private$.sets = sets
self$set_id = "Collection"
},
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test_ParamSetCollection.R
Original file line number Diff line number Diff line change
Expand Up @@ -161,3 +161,9 @@ test_that("empty collections", {
expect_data_table(as.data.table(psc), nrow = 0L)
})


test_that("no problems if we name the list of sets", {
ps = ParamSet$new(list(ParamDbl$new("test1")))
psc = ParamSetCollection$new(list(prefix = ps))
expect_equal(names(psc$params), "paramset.test1")
})

0 comments on commit c7f3cb7

Please sign in to comment.