Skip to content

Commit

Permalink
Adapt tests to use quoted values of 'isic' (#101)
Browse files Browse the repository at this point in the history
  • Loading branch information
maurolepore authored Dec 6, 2023
1 parent 58e5027 commit d59576a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions R/utils-test.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
unquote <- function(x) {
gsub("^'(.*)'$", "\\1", x)
}

format_minimal_snapshot <- function(data) {
str(data, give.attr = FALSE)
}
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-prepare_ictr_company.R
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ test_that("handles numeric `isic*` in `co2`", {
expect_no_error(
profile_emissions_upstream(
companies,
co2 |> modify_col("isic", as.numeric),
co2 |> modify_col("isic", unquote) |> modify_col("isic", as.numeric),
europages_companies = ep_companies,
ecoinvent_activities,
ecoinvent_inputs = ecoinvent_inputs,
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-prepare_pctr_company.R
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ test_that("handles numeric `isic*` in `co2`", {
expect_no_error(
profile_emissions(
companies,
co2 |> head(3) |> modify_col("isic", as.numeric),
co2 |> modify_col("isic", unquote) |> modify_col("isic", as.numeric),
europages_companies = ep_companies,
ecoinvent_activities = ecoinvent_activities,
ecoinvent_europage = small_matches_mapper,
Expand Down

0 comments on commit d59576a

Please sign in to comment.