diff options
Diffstat (limited to 'tests/testthat/test_pai.R')
-rw-r--r-- | tests/testthat/test_pai.R | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/tests/testthat/test_pai.R b/tests/testthat/test_pai.R index f38672d..0d5264a 100644 --- a/tests/testthat/test_pai.R +++ b/tests/testthat/test_pai.R @@ -1,25 +1,16 @@ -# For manual use of this file -require(chents) -require(testthat) - -context("Generation of pai objects") - test_that("a pai object is correctly generated", { skip_on_travis() # server certificate verification failed in curl_fetch_memory() - glyphosate <- pai$new("glyphosate") + {glyphosate <- pai$new("glyphosate")} |> + expect_message("Querying BCPC for glyphosate") |> + expect_message("Querying PubChem for inchikey ") |> + expect_message("Get chemical information from RDKit using PubChem SMILES") - # This did not give results at BCPC in previous times, so it was used to test - # the corresponding warning. - #bc <- pai$new("benzalkonium chloride") - - 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(glyphosate$bcpc$cas, "1071-83-6") + expect_equal(glyphosate$bcpc$formula, "C3H8NO5P") + expect_equal(glyphosate$bcpc$iupac_name, "N-(phosphonomethyl)glycine") expect_equal(names(glyphosate$identifier), "glyphosate") ik = "XDDAORKBJWWYJS-UHFFFAOYSA-N" - attr(ik, "source") <- c("bcpc", "pubchem") - expect_equal(glyphosate$inchikey, ik) - expect_equivalent(round(glyphosate$mw, 2), 169.07) - smiles <- "C(C(=O)O)NCP(=O)(O)O" - expect_equal(glyphosate$smiles[["PubChem"]], smiles) + expect_equal(glyphosate$inchikey, structure("XDDAORKBJWWYJS-UHFFFAOYSA-N", source = c("bcpc", "pubchem"))) + expect_equal(round(glyphosate$mw, 2), structure(169.07, source = "pubchem")) + expect_equal(glyphosate$smiles[["PubChem"]], "C(C(=O)O)NCP(=O)(O)O") }) |