summaryrefslogtreecommitdiff
path: root/tests/testthat
diff options
context:
space:
mode:
Diffstat (limited to 'tests/testthat')
-rw-r--r--tests/testthat/test_chent.R4
-rw-r--r--tests/testthat/test_pai.R17
2 files changed, 11 insertions, 10 deletions
diff --git a/tests/testthat/test_chent.R b/tests/testthat/test_chent.R
index 094ff8b..7594640 100644
--- a/tests/testthat/test_chent.R
+++ b/tests/testthat/test_chent.R
@@ -2,7 +2,7 @@ context("Generation of chent objects")
# Check if we can use RDKit
skip_if_no_rdkit <- function() {
- if (!chents:::rdkit_available()) skip("RDKit is not available via PythonInR")
+ if (!chents:::rdkit_available) skip("RDKit is not available via reticulate")
}
oct <- chent$new("1-octanol", smiles = "CCCCCCCCO", pubchem = FALSE, chyaml = FALSE)
@@ -15,7 +15,7 @@ test_that("We can generate a chent object from SMILES using RDKit", {
})
test_that("We can add information retrieved from PubChem via webchem", {
- oct$try_pubchem()
+ expect_warning(oct$try_pubchem(), "Overwriting uninitialized InChIKey")
expect_equivalent(round(oct$mw, 2), 130.23)
ik = "KBPLFHHGFOOTCA-UHFFFAOYSA-N"
attr(ik, "source") <- "pubchem"
diff --git a/tests/testthat/test_pai.R b/tests/testthat/test_pai.R
index de1f235..518fc56 100644
--- a/tests/testthat/test_pai.R
+++ b/tests/testthat/test_pai.R
@@ -4,18 +4,19 @@ require(testthat)
context("Generation of pai objects")
-test_that("a pai object is correctly generated from an ambiguous name, with warning", {
- expect_warning(glyphosate <- pai$new("glyphosate", chyaml = FALSE))
- expect_warning(pai$new("benzalkonium chloride", chyaml = FALSE))
+test_that("a pai object is correctly generated from an ambiguous name", {
+ skip_on_travis() # server certificate verification failed in curl_fetch_memory()
+ glyphosate <- pai$new("glyphosate", chyaml = FALSE)
+ expect_message(pai$new("benzalkonium chloride", chyaml = FALSE), "did not give results")
- expect_equivalent(glyphosate$alanwood$cas, "1071-83-6")
- expect_equivalent(glyphosate$alanwood$formula, "C3H8NO5P")
- expect_equivalent(glyphosate$alanwood$iupac_name, "N-(phosphonomethyl)glycine")
+ expect_equivalent(glyphosate$bcpc$cas, "1071-83-6")
+ expect_equivalent(glyphosate$bcpc$formula, "C3H8NO5P")
+ expect_equivalent(glyphosate$bcpc$iupac_name, "N-(phosphonomethyl)glycine")
expect_equal(names(glyphosate$identifier), "glyphosate")
ik = "XDDAORKBJWWYJS-UHFFFAOYSA-N"
- attr(ik, "source") <- c("alanwood", "pubchem")
+ attr(ik, "source") <- c("bcpc", "pubchem")
expect_equal(glyphosate$inchikey, ik)
- expect_equivalent(round(glyphosate$mw, 2), 169.07)
+ expect_equivalent(round(glyphosate$mw, 2), 169.07)
smiles <- "C(C(=O)O)NCP(=O)(O)O"
expect_equal(glyphosate$smiles[["PubChem_Canonical"]], smiles)
})

Contact - Imprint