Skip to content
This repository has been archived by the owner on Sep 9, 2022. It is now read-only.

Commit

Permalink
added more tests, fix #2, updating NEWS, cran comments and redame
Browse files Browse the repository at this point in the history
  • Loading branch information
sckott committed Apr 12, 2017
1 parent 7b8a47c commit 18d4eaa
Show file tree
Hide file tree
Showing 17 changed files with 334 additions and 19 deletions.
33 changes: 21 additions & 12 deletions NEWS.md
@@ -1,13 +1,22 @@
rbhl 0.8.0
===============

### MINOR IMPROVEMENTS

* moved to markdown docs and tidied docs to 80 line width (#22)
* replaced `httr` with `crul` for http client (#21)


rbhl 0.3.0
===============

### NEW FEATURES
### NEW FEATURES

* Added code of conduct
* New function `bhl_getinstitutions()` (#16)
* the compact `data.frame` outputs created when `as = "table"` are now
replaced by using `tibble`. in addition, the data.frame used to be
printed as a data.frame, but was actually inside a list accessible by
replaced by using `tibble`. in addition, the data.frame used to be
printed as a data.frame, but was actually inside a list accessible by
`x$data` to get to the data.frame. You no longer need to do that. Now
you run a function, and the output is a data.frame (and a `tbl_df`) (#18)
* Now using `xml2` instead of `XML`
Expand All @@ -20,28 +29,28 @@ you run a function, and the output is a data.frame (and a `tbl_df`) (#18)
rbhl 0.2.0
===============

### NEW FEATURES
### NEW FEATURES

* Gains new funtions `bhl_getauthoparts()`, `bhl_getitemparts()`,
`bhl_getpartbibtex()`, `bhl_getpartbyidentifier()`, `bhl_getpartendnote()`,
`bhl_getpartmetadata()`, `bhl_getpartnames()`, `bhl_getsubjectparts()`,
* Gains new funtions `bhl_getauthoparts()`, `bhl_getitemparts()`,
`bhl_getpartbibtex()`, `bhl_getpartbyidentifier()`, `bhl_getpartendnote()`,
`bhl_getpartmetadata()`, `bhl_getpartnames()`, `bhl_getsubjectparts()`,
`bhl_getunpublishedparts()`, and `bhl_partsearch()` (#6)
* New function `getpages()` to get multiple OCR pages at once, given
* New function `getpages()` to get multiple OCR pages at once, given
an itemid (#4)

### BUG FIXES

* Import all non-base R functions (#13)
* Fix to README, requested by CRAN, to an image that didn't have an alt
* Fix to README, requested by CRAN, to an image that didn't have an alt
attribute (#8) (#11) (#12)
* Removed arguments in `bhl_getpageocrtext()` for names and ocr that
* Removed arguments in `bhl_getpageocrtext()` for names and ocr that
weren't actually available in the API method. (#3)
* Some functions were missing parameters, and have now been added in where
* Some functions were missing parameters, and have now been added in where
appropriate. (#5)

rbhl 0.1.0
===============

### NEW FEATURES
### NEW FEATURES

* released to CRAN
2 changes: 1 addition & 1 deletion README.Rmd
Expand Up @@ -12,7 +12,7 @@ knitr::opts_chunk$set(

[![Build Status](https://api.travis-ci.org/ropensci/rbhl.png)](https://travis-ci.org/ropensci/rbhl)
[![Build status](https://ci.appveyor.com/api/projects/status/ej5u9mdirg1yyteg/branch/master)](https://ci.appveyor.com/project/sckott/rbhl/branch/master)
[![rstudio mirror downloads](http://cranlogs.r-pkg.org/badges/grand-total/rbhl?color=2ECC71)](https://github.com/metacran/cranlogs.app)
[![rstudio mirror downloads](http://cranlogs.r-pkg.org/badges/rbhl?color=2ECC71)](https://github.com/metacran/cranlogs.app)
[![cran version](http://www.r-pkg.org/badges/version/rbhl)](https://cran.r-project.org/package=rbhl)
[![codecov.io](https://codecov.io/github/ropensci/rbhl/coverage.svg?branch=master)](https://codecov.io/github/ropensci/rbhl?branch=master)

Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -5,7 +5,7 @@ rbhl

[![Build Status](https://api.travis-ci.org/ropensci/rbhl.png)](https://travis-ci.org/ropensci/rbhl)
[![Build status](https://ci.appveyor.com/api/projects/status/ej5u9mdirg1yyteg/branch/master)](https://ci.appveyor.com/project/sckott/rbhl/branch/master)
[![rstudio mirror downloads](http://cranlogs.r-pkg.org/badges/grand-total/rbhl?color=2ECC71)](https://github.com/metacran/cranlogs.app)
[![rstudio mirror downloads](http://cranlogs.r-pkg.org/badges/rbhl?color=2ECC71)](https://github.com/metacran/cranlogs.app)
[![cran version](http://www.r-pkg.org/badges/version/rbhl)](https://cran.r-project.org/package=rbhl)
[![codecov.io](https://codecov.io/github/ropensci/rbhl/coverage.svg?branch=master)](https://codecov.io/github/ropensci/rbhl?branch=master)

Expand Down
9 changes: 4 additions & 5 deletions cran-comments.md
@@ -1,7 +1,7 @@
## Test environments

* local OS X install, R 3.3.2
* ubuntu 12.04 (on travis-ci), R 3.3.2
* local OS X install, R 3.3.3
* ubuntu 12.04 (on travis-ci), R 3.3.3
* win-builder (devel and release)
* R-hub (Windows R-devel, Linux R-release, Linux R-devel)

Expand All @@ -12,7 +12,7 @@
License components with restrictions and base license permitting such:
MIT + file LICENSE
File 'LICENSE':
YEAR: 2016
YEAR: 2017
COPYRIGHT HOLDER: Scott Chamberlain

## Reverse dependencies
Expand All @@ -21,8 +21,7 @@ There are no reverse dependencies.

---

This version adds a new function, and changes a number of imports, and
outputs tibble's now instead of data.frame's.
This version xxxx

Thanks!
Scott Chamberlain
24 changes: 24 additions & 0 deletions tests/testthat/test-bhl_gettitleitems.R
@@ -0,0 +1,24 @@
context("bhl_gettitleitems")

test_that("bhl_gettitleitems works", {
skip_on_cran()

tt <- bhl_gettitleitems(1726)
vv <- bhl_gettitleitems(1726, as='xml')
zz <- bhl_gettitleitems(1726, as='json')

# the correct classes
expect_is(tt, "data.frame")

expect_is(zz, "character")
expect_is(jsonlite::fromJSON(zz), "list")

expect_is(vv, "character")
expect_is(xml2::read_xml(vv), "xml_document")

# the correct dimensions
expect_equal(length(zz), 1)
expect_equal(length(jsonlite::fromJSON(zz)), 3)
expect_equal(length(vv), 1)
expect_equal(length(xml2::read_xml(vv)), 2)
})
24 changes: 24 additions & 0 deletions tests/testthat/test-bhl_gettitlemetadata.R
@@ -0,0 +1,24 @@
context("bhl_gettitlemetadata")

test_that("bhl_gettitlemetadata works", {
skip_on_cran()

tt <- bhl_gettitlemetadata(1726)
vv <- bhl_gettitlemetadata(1726, as='xml')
zz <- bhl_gettitlemetadata(1726, as='json')

# the correct classes
expect_is(tt, "list")

expect_is(zz, "character")
expect_is(jsonlite::fromJSON(zz), "list")

expect_is(vv, "character")
expect_is(xml2::read_xml(vv), "xml_document")

# the correct dimensions
expect_equal(length(zz), 1)
expect_equal(length(jsonlite::fromJSON(zz)), 3)
expect_equal(length(vv), 1)
expect_equal(length(xml2::read_xml(vv)), 2)
})
24 changes: 24 additions & 0 deletions tests/testthat/test-bhl_getunpublisheditems.R
@@ -0,0 +1,24 @@
context("bhl_getunpublisheditems")

test_that("bhl_getunpublisheditems works", {
skip_on_cran()

tt <- bhl_getunpublisheditems()
vv <- bhl_getunpublisheditems(as='xml')
zz <- bhl_getunpublisheditems(as='json')

# the correct classes
expect_is(tt, "data.frame")

expect_is(zz, "character")
expect_is(jsonlite::fromJSON(zz), "list")

expect_is(vv, "character")
expect_is(xml2::read_xml(vv), "xml_document")

# the correct dimensions
expect_equal(length(zz), 1)
expect_equal(length(jsonlite::fromJSON(zz)), 3)
expect_equal(length(vv), 1)
expect_equal(length(xml2::read_xml(vv)), 2)
})
24 changes: 24 additions & 0 deletions tests/testthat/test-bhl_getunpublishedparts.R
@@ -0,0 +1,24 @@
context("bhl_getunpublishedparts")

test_that("bhl_getunpublishedparts works", {
skip_on_cran()

tt <- bhl_getunpublishedparts()
vv <- bhl_getunpublishedparts(as='xml')
zz <- bhl_getunpublishedparts(as='json')

# the correct classes
expect_is(tt, "data.frame")

expect_is(zz, "character")
expect_is(jsonlite::fromJSON(zz), "list")

expect_is(vv, "character")
expect_is(xml2::read_xml(vv), "xml_document")

# the correct dimensions
expect_equal(length(zz), 1)
expect_equal(length(jsonlite::fromJSON(zz)), 3)
expect_equal(length(vv), 1)
expect_equal(length(xml2::read_xml(vv)), 2)
})
24 changes: 24 additions & 0 deletions tests/testthat/test-bhl_getunpublishedtitles.R
@@ -0,0 +1,24 @@
context("bhl_getunpublishedtitles")

test_that("bhl_getunpublishedtitles works", {
skip_on_cran()

tt <- bhl_getunpublishedtitles()
vv <- bhl_getunpublishedtitles(as='xml')
zz <- bhl_getunpublishedtitles(as='json')

# the correct classes
expect_is(tt, "data.frame")

expect_is(zz, "character")
expect_is(jsonlite::fromJSON(zz), "list")

expect_is(vv, "character")
expect_is(xml2::read_xml(vv), "xml_document")

# the correct dimensions
expect_equal(length(zz), 1)
expect_equal(length(jsonlite::fromJSON(zz)), 3)
expect_equal(length(vv), 1)
expect_equal(length(xml2::read_xml(vv)), 2)
})
21 changes: 21 additions & 0 deletions tests/testthat/test-bhl_namecount.R
@@ -0,0 +1,21 @@
context("bhl_namecount")

test_that("bhl_namecount works", {
skip_on_cran()

tt <- bhl_namecount(startdate = '12/25/2009', enddate = '12/27/2009')
zz <- bhl_namecount(startdate = '12/25/2009', enddate = '12/27/2009',
as='json')

# the correct classes
expect_is(tt, "data.frame")

expect_is(zz, "character")
expect_is(jsonlite::fromJSON(zz), "list")

# the correct dimensions
expect_equal(length(zz), 1)
expect_equal(length(jsonlite::fromJSON(zz)), 3)
expect_equal(length(vv), 1)
expect_equal(length(xml2::read_xml(vv)), 2)
})
27 changes: 27 additions & 0 deletions tests/testthat/test-bhl_namelist.R
@@ -0,0 +1,27 @@
context("bhl_namelist")

test_that("bhl_namelist works", {
skip_on_cran()

tt <- bhl_namelist(startrow=1, batchsize=99, startdate='10/15/2009',
enddate='10/16/2009')
vv <- bhl_namelist(startrow=1, batchsize=99, startdate='10/15/2009',
enddate='10/16/2009', as = "xml")
zz <- bhl_namelist(startrow=1, batchsize=99, startdate='10/15/2009',
enddate='10/16/2009', as = "json")

# the correct classes
expect_is(tt, "data.frame")

expect_is(zz, "character")
expect_is(jsonlite::fromJSON(zz), "list")

expect_is(vv, "character")
expect_is(xml2::read_xml(vv), "xml_document")

# the correct dimensions
expect_equal(length(zz), 1)
expect_equal(length(jsonlite::fromJSON(zz)), 3)
expect_equal(length(vv), 1)
expect_equal(length(xml2::read_xml(vv)), 2)
})
24 changes: 24 additions & 0 deletions tests/testthat/test-bhl_namesearch.R
@@ -0,0 +1,24 @@
context("bhl_namesearch")

test_that("bhl_namesearch works", {
skip_on_cran()

tt <- bhl_namesearch('poa annua')
vv <- bhl_namesearch('poa annua', as='xml')
zz <- bhl_namesearch('poa annua', as='json')

# the correct classes
expect_is(tt, "data.frame")

expect_is(zz, "character")
expect_is(jsonlite::fromJSON(zz), "list")

expect_is(vv, "character")
expect_is(xml2::read_xml(vv), "xml_document")

# the correct dimensions
expect_equal(length(zz), 1)
expect_equal(length(jsonlite::fromJSON(zz)), 3)
expect_equal(length(vv), 1)
expect_equal(length(xml2::read_xml(vv)), 2)
})
30 changes: 30 additions & 0 deletions tests/testthat/test-bhl_openurl.R
@@ -0,0 +1,30 @@
context("bhl_openurl")

test_that("bhl_openurl works", {
skip_on_cran()

tt <- bhl_openurl(genre="book", title="Manual+of+North+American+Diptera",
aufirst="Samuel Wendell", aulast="Williston", date=1908,
spage=16)
vv <- bhl_openurl(genre="book", title="Manual+of+North+American+Diptera",
aufirst="Samuel Wendell", aulast="Williston", date=1908,
spage=16, as='xml')
zz <- bhl_openurl(genre="book", title="Manual+of+North+American+Diptera",
aufirst="Samuel Wendell", aulast="Williston", date=1908,
spage=16, as='json')

# the correct classes
expect_is(tt, "list")

expect_is(zz, "character")
expect_is(jsonlite::fromJSON(zz), "list")

expect_is(vv, "character")
expect_is(xml2::read_xml(vv), "xml_document")

# the correct dimensions
expect_equal(length(zz), 1)
expect_equal(length(jsonlite::fromJSON(zz)), 3)
expect_equal(length(vv), 1)
expect_equal(length(xml2::read_xml(vv)), 2)
})
24 changes: 24 additions & 0 deletions tests/testthat/test-bhl_partsearch.R
@@ -0,0 +1,24 @@
context("bhl_partsearch")

test_that("bhl_partsearch works", {
skip_on_cran()

tt <- bhl_partsearch(author='Charles Darwin')
vv <- bhl_partsearch(author='Charles Darwin', as='xml')
zz <- bhl_partsearch(author='Charles Darwin', as='json')

# the correct classes
expect_is(tt, "data.frame")

expect_is(zz, "character")
expect_is(jsonlite::fromJSON(zz), "list")

expect_is(vv, "character")
expect_is(xml2::read_xml(vv), "xml_document")

# the correct dimensions
expect_equal(length(zz), 1)
expect_equal(length(jsonlite::fromJSON(zz)), 3)
expect_equal(length(vv), 1)
expect_equal(length(xml2::read_xml(vv)), 2)
})
24 changes: 24 additions & 0 deletions tests/testthat/test-bhl_subjectsearch.R
@@ -0,0 +1,24 @@
context("bhl_subjectsearch")

test_that("bhl_subjectsearch works", {
skip_on_cran()

tt <- bhl_subjectsearch('diptera')
vv <- bhl_subjectsearch('diptera', as='xml')
zz <- bhl_subjectsearch('diptera', as='json')

# the correct classes
expect_is(tt, "data.frame")

expect_is(zz, "character")
expect_is(jsonlite::fromJSON(zz), "list")

expect_is(vv, "character")
expect_is(xml2::read_xml(vv), "xml_document")

# the correct dimensions
expect_equal(length(zz), 1)
expect_equal(length(jsonlite::fromJSON(zz)), 3)
expect_equal(length(vv), 1)
expect_equal(length(xml2::read_xml(vv)), 2)
})

0 comments on commit 18d4eaa

Please sign in to comment.