Skip to content

Commit

Permalink
Merge pull request #35 from worldbank/DEV
Browse files Browse the repository at this point in the history
Fix argument selection
  • Loading branch information
tonyfujs authored Jul 20, 2022
2 parents 2700290 + 126f735 commit 2b4c01c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 5 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: pipr
Title: Client for the PIP API
Version: 0.0.1
Version: 0.0.2
Authors@R:
c(person(given = "Tony",
family = "Fujs",
Expand Down Expand Up @@ -56,4 +56,3 @@ Depends:
VignetteBuilder: knitr
Config/testthat/edition: 3
Date: 2022-04-08

5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# pipr 0.0.2

## Bug fixes
* Fix `popshare` argument not being passed to `get_stats()`

# pipr 0.0.1

* [CRAN release](https://github.com/worldbank/pipr/issues/18)
Expand Down
11 changes: 8 additions & 3 deletions R/get_stats.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,16 @@ get_stats <- function(country = "all",

# Build query string
args <- build_args(
country = country, year = year, povline = povline,
fill_gaps = fill_gaps, group_by = group_by,
country = country,
year = year,
povline = povline,
popshare = popshare,
fill_gaps = fill_gaps,
group_by = group_by,
welfare_type = welfare_type,
reporting_level = reporting_level,
version = version, format = format
version = version,
format = format
)
u <- build_url(server, endpoint, api_version)

Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-get_stats.R
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@ test_that("get_stats() works w/ fill_gaps = TRUE", {
test_that("get_stats() works w/ popshare option", {
df <- get_stats("AGO", year = "all", popshare = .5)
expect_gte(nrow(df), 3)
#Ensure there are different values for headcount generated
#to confirm popshare is being passed to get_stats() function.
expect_gte(length(unique(df$headcount)), 1)
})

test_that("get_stats() works w/ subgroup = 'wb_regions'", {
Expand Down

0 comments on commit 2b4c01c

Please sign in to comment.