Skip to content

Commit

Permalink
fix error checking for named input
Browse files Browse the repository at this point in the history
  • Loading branch information
nikosbosse committed Jan 2, 2024
1 parent 0d96e56 commit 2253c6b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion R/default-scoring-rules.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#' )
select_rules <- function(rules, select = "all", exclude = NULL) {
assert_character(x = c(select, exclude), null.ok = TRUE)
assert_list(rules, names = TRUE)
assert_list(rules, names = "named")
allowed <- names(rules)

if (select == "all" && is.null(exclude)) {
Expand Down
5 changes: 5 additions & 0 deletions tests/testthat/test-default-scoring-rules.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ test_that("`select_rules` works as expected", {
rules_point()
)

expect_equal(
scoringutils:::select_rules(rules_point(), select = "all"),
scoringutils:::select_rules(rules_point())
)

expect_equal(
names(scoringutils:::select_rules(rules_point(), select = "ape")),
"ape"
Expand Down

0 comments on commit 2253c6b

Please sign in to comment.