Skip to content

Commit

Permalink
more fixes to tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eduardszoecs committed Aug 28, 2015
1 parent 87467e9 commit cd9b2a0
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion NEWS
Expand Up @@ -9,9 +9,12 @@ NEW FEATURES

MINOR IMPROVEMENTS

* added exceptions to tests

BUG FIXES

* Correct the spelling of Alan Wood and rename function allanwood() to alanwood()
* Correct the spelling of Alan Wood and rename function allanwood() to alanwood().



webchem 0.0.2
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-alanwood.R
@@ -1,5 +1,6 @@
context("alanwood")

require(RCurl)
chk_alanwood <- function(){
qurl <- 'http://www.alanwood.net/pesticides/index_cn.html'
Sys.sleep(0.2)
Expand Down
1 change: 1 addition & 0 deletions tests/testthat/test-pan.R
@@ -1,5 +1,6 @@
context("pan")

require(RCurl)
chk_pan <- function(){
qurl <- 'http://www.pesticideinfo.org/List_Chemicals.jsp?ChemName=2,4-dichlorophenol'
Sys.sleep(0.2)
Expand Down
7 changes: 4 additions & 3 deletions tests/testthat/test-pubchem.R
@@ -1,5 +1,6 @@
context("pubchem")

require(RCurl)
chk_pubchem <- function(){
qurl <- 'http://eutils.ncbi.nlm.nih.gov/entrez/eutils/esearch.fcgi?retmax=100000&db=pccompound&term=Triclosan'
Sys.sleep(0.2)
Expand All @@ -11,10 +12,9 @@ chk_pubchem <- function(){

test_that("get_cid()", {
chk_pubchem()

expect_equal(get_cid('Triclosan')[1], '5564')
expect_equal(length(get_cid('Triclosan', first = TRUE, verbose = FALSE)), 1)
Sys.sleep(0.2)
chk_pubchem()
expect_equal(get_cid('xxxxx', verbose = FALSE), NA)
expect_error(get_cid(c('xxxxx', 'aaaaaaa')))
expect_warning(get_cid(NA))
Expand All @@ -25,9 +25,10 @@ test_that("cid_compinfo", {
chk_pubchem()

expect_error(cid_compinfo(c('xxxxx', 'aaaaaaa')))
Sys.sleep(0.2)
chk_pubchem()
expect_equal(cid_compinfo('5564', verbose = FALSE)$CanonicalSmiles, "C1=CC(=C(C=C1Cl)O)OC2=C(C=C(C=C2)Cl)Cl")
expect_equal(length(cid_compinfo('5564', verbose = FALSE)), 25)
chk_pubchem()
expect_equal(length(cid_compinfo('5564', first = TRUE, verbose = FALSE)$synonyms), 1)
expect_equal(get_cid('xxxxx', verbose = FALSE), NA)
})

0 comments on commit cd9b2a0

Please sign in to comment.