This repository has been archived by the owner on Sep 9, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added more tests, fix #2, updating NEWS, cran comments and redame
- Loading branch information
Showing
17 changed files
with
334 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
}) |
Oops, something went wrong.