Skip to content

Commit

Permalink
Merge pull request #445 from orichters/conv2005-17
Browse files Browse the repository at this point in the history
mini improvement of failing test message
  • Loading branch information
orichters authored Feb 5, 2025
2 parents 7fe0b6d + a9da8b2 commit f992d4a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
2 changes: 1 addition & 1 deletion .buildlibrary
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ValidationKey: '8854560'
ValidationKey: '8874684'
AutocreateReadme: yes
allowLinterWarnings: no
AddInReadme: tutorial.md
Expand Down
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cff-version: 1.2.0
message: If you use this software, please cite it using the metadata from this file.
type: software
title: 'piamInterfaces: Project specific interfaces to REMIND / MAgPIE'
version: 0.44.0
version: 0.44.1
date-released: '2025-02-05'
abstract: Project specific interfaces to REMIND / MAgPIE.
authors:
Expand Down
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Type: Package
Package: piamInterfaces
Title: Project specific interfaces to REMIND / MAgPIE
Version: 0.44.0
Version: 0.44.1
Date: 2025-02-05
Authors@R: c(
person("Falk", "Benke", , "[email protected]", role = c("aut", "cre")),
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Project specific interfaces to REMIND / MAgPIE

R package **piamInterfaces**, version **0.44.0**
R package **piamInterfaces**, version **0.44.1**

[![CRAN status](https://www.r-pkg.org/badges/version/piamInterfaces)](https://cran.r-project.org/package=piamInterfaces) [![R build status](https://github.com/pik-piam/piamInterfaces/workflows/check/badge.svg)](https://github.com/pik-piam/piamInterfaces/actions) [![codecov](https://codecov.io/gh/pik-piam/piamInterfaces/branch/master/graph/badge.svg)](https://app.codecov.io/gh/pik-piam/piamInterfaces) [![r-universe](https://pik-piam.r-universe.dev/badges/piamInterfaces)](https://pik-piam.r-universe.dev/builds)

Expand Down Expand Up @@ -162,7 +162,7 @@ In case of questions / problems please contact Falk Benke <[email protected]>

To cite package **piamInterfaces** in publications use:

Benke F, Richters O (2025). "piamInterfaces: Project specific interfaces to REMIND / MAgPIE." Version: 0.44.0, <https://github.com/pik-piam/piamInterfaces>.
Benke F, Richters O (2025). "piamInterfaces: Project specific interfaces to REMIND / MAgPIE." Version: 0.44.1, <https://github.com/pik-piam/piamInterfaces>.

A BibTeX entry for LaTeX users is

Expand All @@ -173,6 +173,6 @@ A BibTeX entry for LaTeX users is
date = {2025-02-05},
year = {2025},
url = {https://github.com/pik-piam/piamInterfaces},
note = {Version: 0.44.0},
note = {Version: 0.44.1},
}
```
21 changes: 11 additions & 10 deletions tests/testthat/test-getMapping.R
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ for (mapping in names(mappingNames())) {
pull("variable")
if (length(factorWithComma) > 0) {
warning("These variables in mapping ", mapping, " have a piam_factor using a ',' as decimal. Please use '.':\n",
paste(factorWithComma, collapse = "\n"),
paste("-", factorWithComma, collapse = "\n"),
"\nYou can run: devtools::load_all(); write.csv2(getMapping('", mapping,
"') %>% mutate(piam_factor = gsub(',', '.', .data$piam_factor)), mappingNames('", mapping,
"'), na = '', row.names = FALSE, quote = FALSE)")
Expand Down Expand Up @@ -102,7 +102,7 @@ for (mapping in names(mappingNames())) {
pull("variable")
if (length(factorWithoutVar) > 0) {
warning("These variables in mapping ", mapping, " have a piam_factor, but nothing specified in piam_variable:\n",
paste(factorWithoutVar, collapse = "\n"))
paste("-", factorWithoutVar, collapse = "\n"))
}
expect_length(factorWithoutVar, 0)

Expand All @@ -114,30 +114,31 @@ for (mapping in names(mappingNames())) {
pull("variable")
if (length(sourceWithoutVar) > 0) {
warning("These variables in mapping ", mapping, " have a non-empty source column, ",
"but nothing specified in piam_variable:\n", paste(sourceWithoutVar, collapse = "\n"))
"but nothing specified in piam_variable:\n", paste("-", sourceWithoutVar, collapse = "\n"))
}
expect_length(sourceWithoutVar, 0)

sources <- read.csv2(system.file("sources.csv", package = "piamInterfaces"))
sourceinfo <- paste0("The options are ", paste0(sources$symbol, " (", sources$model, ")", collapse = ", "), ".")

# check for piam_variable without source if source is supplied
varWithoutSource <- mappingData %>%
filter(! is.na(.data$piam_variable), is.na(.data$source)) %>%
pull("piam_variable") %>%
unique()
if (length(varWithoutSource) > 0) {
warning("These piam_variable in mapping ", mapping, " have an empty source column, see tutorial.md:\n",
paste(varWithoutSource, collapse = "\n"))
paste("-", varWithoutSource, collapse = "\n"), "\n", sourceinfo)
}
expect_length(varWithoutSource, 0)

# add here once you added new options to the tutorial
sources <- read.csv2(system.file("sources.csv", package = "piamInterfaces"))
# check whether all sources are described in inst/sources.csv
sourceOptions <- sort(c(sources$symbol, paste0(sources$symbol, "x")))
unknownSource <- mappingData %>% pull("source") %>% unique() %>% setdiff(c(NA, sourceOptions))
if (length(unknownSource) > 0) {
warning("The source column of mapping ", mapping, " contains these unknown options:\n",
paste0(unknownSource, collapse = ", "),
".\nThe only options are ", paste0(sources$symbol, " (", sources$model, ")", collapse = ", "), ".\n",
"New options should be explained in 'tutorial.md' and added to 'inst/sources.csv'.")
warning("The source column of mapping ", mapping, " contains these unknown options: ",
paste0(unknownSource, collapse = ", "), "\n", sourceinfo,
"\nNew options should be explained in 'tutorial.md' and added to 'inst/sources.csv'.")
}
expect_length(unknownSource, 0)
} # end source checks
Expand Down

0 comments on commit f992d4a

Please sign in to comment.