aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2016-10-14 15:24:43 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2016-10-14 15:24:43 +0200
commite85f61000c139492ec6497aa3c6206a66b54d783 (patch)
tree7b008b9c1e7a212f1b05502af00c5b75f7c1f013 /tests
parent6cfe5fbd827ca37f24134e8356e8144520ee1265 (diff)
Better handling of ambiguous names and "source"s
Diffstat (limited to 'tests')
-rw-r--r--tests/testthat/test_pai.R22
1 files changed, 10 insertions, 12 deletions
diff --git a/tests/testthat/test_pai.R b/tests/testthat/test_pai.R
index 1718a9a..a0b7704 100644
--- a/tests/testthat/test_pai.R
+++ b/tests/testthat/test_pai.R
@@ -1,23 +1,21 @@
+# For manual use of this file
+require(chents)
+require(testthat)
+
context("Generation of pai objects")
-glyphosate <- pai$new("glyphosate", chyaml = FALSE)
-
-test_that("a pai object is generated from its ISO common name", {
+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))
+
expect_equivalent(glyphosate$alanwood$cas, "1071-83-6")
expect_equivalent(glyphosate$alanwood$formula, "C3H8NO5P")
expect_equivalent(glyphosate$alanwood$iupac_name, "N-(phosphonomethyl)glycine")
expect_equal(names(glyphosate$identifier), "glyphosate")
ik = "XDDAORKBJWWYJS-UHFFFAOYSA-N"
- attr(ik, "source") <- "alanwood"
+ attr(ik, "source") <- c("alanwood", "pubchem")
expect_equal(glyphosate$inchikey, ik)
-})
-
-test_that("a pai object is generated from an ambiguous name", {
- deltamethrin <- pai$new("deltamethrin", chyaml = FALSE)
-})
-
-test_that("PubChem information was added via webchem", {
expect_equivalent(round(glyphosate$mw, 2), 169.07)
- smiles <- "C(C(=O)O)NCP(=O)(O)O"
+ smiles <- "C(C(=O)O)[NH2+]CP(=O)(O)[O-]"
expect_equal(glyphosate$smiles[["PubChem_Canonical"]], smiles)
})

Contact - Imprint