Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
kalashsinghal committed Oct 27, 2024
1 parent a73b003 commit 7b4668d
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

export(add_benchmark_tr_score)
export(add_thresholds_transition_risk)
export(add_transition_risk_category)
export(add_transition_risk_category_at_product_level)
export(add_transition_risk_score)
export(best_case_worst_case_transition_risk_profile)
export(example_emissions_profile_at_product_level)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
#' scenarios
#' )
#'
#' output <- add_transition_risk_category(transition_risk_thresholds)
#' output <- add_transition_risk_category_at_product_level(transition_risk_thresholds)
#' output
add_transition_risk_category <- function(data) {
add_transition_risk_category_at_product_level <- function(data) {
check_crucial_cols(data, c(
col_transition_risk_score(), col_tr_low_threshold(),
col_tr_high_threshold()
Expand Down
2 changes: 1 addition & 1 deletion R/transition_risk_profile.R
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ transition_risk_profile_impl <- function(emissions_profile,
"benchmark_tr_score",
"activity_uuid_product_uuid"
)) |>
add_transition_risk_category() |>
add_transition_risk_category_at_product_level() |>
best_case_worst_case_transition_risk_profile() |>
polish_best_case_worst_case() |>
polish_best_case_worst_case_transition_risk_profile()
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@ test_that("if input data lacks crucial columns, errors gracefully", {

crucial <- col_transition_risk_score()
bad <- select(input_data, -all_of(crucial))
expect_error(add_transition_risk_category(bad), crucial)
expect_error(add_transition_risk_category_at_product_level(bad), crucial)

crucial <- col_tr_low_threshold()
bad <- select(input_data, -all_of(crucial))
expect_error(add_transition_risk_category(bad), crucial)
expect_error(add_transition_risk_category_at_product_level(bad), crucial)

crucial <- col_tr_high_threshold()
bad <- select(input_data, -all_of(crucial))
expect_error(add_transition_risk_category(bad), crucial)
expect_error(add_transition_risk_category_at_product_level(bad), crucial)
})

test_that("if `transition_risk_category` column has only NAs, then class of the column is `character`", {
Expand All @@ -34,7 +34,7 @@ test_that("if `transition_risk_category` column has only NAs, then class of the
all_activities_scenario_sectors,
scenarios
) |>
add_transition_risk_category()
add_transition_risk_category_at_product_level()

expected_class <- "character"
expect_equal(class(output$transition_risk_category), expected_class)
Expand Down

0 comments on commit 7b4668d

Please sign in to comment.