Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dieghernan committed Sep 23, 2024
1 parent df7b8fc commit 0f9e242
Show file tree
Hide file tree
Showing 14 changed files with 39 additions and 45 deletions.
2 changes: 1 addition & 1 deletion CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ references:
authors:
- family-names: Ooms
given-names: Jeroen
email: [email protected]
email: [email protected]
orcid: https://orcid.org/0000-0002-4035-0289
year: '2024'
identifiers:
Expand Down
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -360,8 +360,7 @@ This package is in no way officially related to or endorsed by Eurostat.

## References

<div id="refs" class="references csl-bib-body hanging-indent"
entry-spacing="0">
<div id="refs" class="references csl-bib-body hanging-indent">

<div id="ref-RJ-2017-019" class="csl-entry">

Expand Down
4 changes: 2 additions & 2 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.4.1 (2024-06-14 ucrt)",
"runtimePlatform": "R version 4.4.1 (2024-06-14)",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand Down Expand Up @@ -240,7 +240,7 @@
"applicationCategory": "cartography",
"isPartOf": "http://ropengov.org/",
"keywords": ["ropengov", "r", "spatial", "api-wrapper", "rstats", "r-package", "eurostat", "gisco", "thematic-maps", "eurostat-data", "cran", "ggplot2", "gis"],
"fileSize": "1244.028KB",
"fileSize": "1234.726KB",
"citation": [
{
"@type": "SoftwareSourceCode",
Expand Down
Binary file modified data/gisco_countrycode.rda
Binary file not shown.
Binary file modified data/gisco_db.rda
Binary file not shown.
Binary file modified img/README-example-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/README-example-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/README-labels-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified img/README-thematic-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion inst/schemaorg.json
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"runtimePlatform": "R version 4.4.1 (2024-06-14 ucrt)",
"runtimePlatform": "R version 4.4.1 (2024-06-14)",
"version": "0.6.0"
},
{
Expand Down
73 changes: 34 additions & 39 deletions tests/testthat/test-gisco_get_communes.R
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
test_that("Communes offline", {
expect_error(gisco_get_communes(year = "2007"))
expect_error(gisco_get_communes(epsg = "9999"))
expect_error(gisco_get_communes(year = "2004", spatialtype = "COASTL"))
expect_error(gisco_get_communes(year = "2004", spatialtype = "INLAND"))
expect_error(gisco_get_communes(spatialtype = "ERR"))
})

test_that("Communes online", {
skip_on_cran()
skip_if_gisco_offline()

expect_silent(gisco_get_communes(spatialtype = "COASTL"))

# Trying to query a dataset without a country field. Should show a message
# even with verbose TRUE
expect_message(gisco_get_communes(
spatialtype = "COASTL",
country = "LU", verbose = FALSE
))

expect_message(gisco_get_communes(spatialtype = "LB", verbose = TRUE))
lu <- expect_silent(gisco_get_communes(spatialtype = "LB", country = "LU"))

expect_equal(as.character(unique(lu$CNTR_CODE)), "LU")

# Test selected years
years <- c("2001", "2013")

# Liechtenstein
for (i in seq_len(length(years))) {
lb <- gisco_get_communes(
spatialtype = "LB", country = "LU", year = years[i],
verbose = FALSE
)

expect_equal(as.character(unique(lb$CNTR_CODE)), "LU")
}
})
test_that("Communes offline", {
expect_error(gisco_get_communes(year = "2007"))
expect_error(gisco_get_communes(epsg = "9999"))
expect_error(gisco_get_communes(year = "2004", spatialtype = "COASTL"))
expect_error(gisco_get_communes(year = "2004", spatialtype = "INLAND"))
expect_error(gisco_get_communes(spatialtype = "ERR"))
})

test_that("Communes online", {
skip_on_cran()
skip_if_gisco_offline()

expect_silent(gisco_get_communes(spatialtype = "COASTL"))

# Trying to query a dataset without a country field. Should show a message
# even with verbose TRUE
expect_message(gisco_get_communes(
spatialtype = "COASTL",
country = "LU", verbose = FALSE
))

expect_message(gisco_get_communes(spatialtype = "LB", verbose = TRUE))
lu <- expect_silent(gisco_get_communes(spatialtype = "LB", country = "LU"))

expect_equal(as.character(unique(lu$CNTR_CODE)), "LU")

# Test selected years
lb <- gisco_get_communes(
spatialtype = "LB", country = "LU", year = "2013",
verbose = FALSE
)

expect_equal(as.character(unique(lb$CNTR_CODE)), "LU")
})
Binary file modified vignettes/africa-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/country-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified vignettes/giscoR-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 0f9e242

Please sign in to comment.