Skip to content

Commit

Permalink
Remove some testthat warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
Bisaloo committed Mar 19, 2021
1 parent 47e72e2 commit c8aec3f
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion tests/testthat/test-S3colspace.R
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ test_that("summary.colspace", {
summary_subset <- expect_message(summary(tcs_sicalis[, -17]), "subset data")
expect_equal(summary_subset, summary.data.frame(tcs_sicalis[, -17]))

tri_sicalis <- colspace(vismodel(sicalis, "cie10"), "tri")
tri_sicalis <- expect_warning(colspace(vismodel(sicalis, "cie10"), "tri"))
expect_equal(
expect_output(summary(tri_sicalis)),
summary.data.frame(tri_sicalis)
Expand Down
8 changes: 6 additions & 2 deletions tests/testthat/test-S3rspec.R
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,18 @@ test_that("as.rspec", {
expect_identical(flowers, flowers2)

# Both text and numerically identify wavelength column
refl1 <- rnorm(401)
refl1 <- rnorm(401, mean = 5)
fake1 <- data.frame(wave = 300:700, refl1)
fake2 <- data.frame(refl1, wave = 300:700)
expect_identical(as.rspec(fake1, whichwl = "wave"), as.rspec(fake2, whichwl = 2))

# Interpolation should not happen outside of wl range by default
flowers3 <- flowers[-1, ]
expect_identical(flowers3, as.rspec(flowers3), ignore_attr = TRUE)
rownames(flowers3) <- NULL
expect_identical(
flowers3,
expect_message(as.rspec(flowers3))
)

# With rule = 2, missing values outside of range are generated
flowers3_fullrange <- expect_warning(
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-colspace.R
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,8 @@ test_that("CIE", {

# Should ignore custom options when data are class vismodel()
expect_equal(
colspace(vismodel(flowers, "cie10"), space = "cielab", visual = "cie10", illum = "D65"),
colspace(vismodel(flowers, "cie10"), space = "cielab", visual = "cie2", illum = "bluesky")
expect_warning(colspace(vismodel(flowers, "cie10"), space = "cielab", visual = "cie10", illum = "D65")),
expect_warning(colspace(vismodel(flowers, "cie10"), space = "cielab", visual = "cie2", illum = "bluesky"))
)

# Message about the use of user-defined data
Expand Down
8 changes: 5 additions & 3 deletions tests/testthat/test-hashes.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
local_edition(2)

test_that("coldist", {
skip_on_cran()

Expand Down Expand Up @@ -38,7 +40,7 @@ test_that("coldist", {
digest::sha1(coldist(colspace(vismodel(flowers, visual = "cie10", illum = "D65", vonkries = TRUE, relative = FALSE), 'cielab')), digits = 4),
"ab8d1c2eac211561f68759137baa2b5d3005b199"
)

# Bootcoldist output (means only, since CI's are bootstrapped)
## RN model
# data(sicalis)
Expand All @@ -48,7 +50,7 @@ test_that("coldist", {
# digest::sha1(bootcoldist(vm, by = gr, n = c(1, 2, 2, 4), weber = 0.1, weber.achro = 0.1)[, c(1, 4)]),
# "5f29a9d9c57f922e439e419a4691445e7d67555d"
# )
#
#
# ## Tcs
# vm <- vismodel(sicalis, achromatic = "bt.dc")
# space <- colspace(vm)
Expand All @@ -57,7 +59,7 @@ test_that("coldist", {
# digest::sha1(bootcoldist(space, by = gr)[, c(1, 4)]),
# "1abaef8c25cb8a91f79730be80207cea15e064d6"
# )
#
#
# ## Hexagon
# data(flowers)
# vis.flowers <- vismodel(flowers,
Expand Down
5 changes: 4 additions & 1 deletion tests/testthat/test-processing.R
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ test_that("Procspec", {
expect_message(dim(procspec(sicalis, opt = "smooth")), "smoothing")
expect_equal(
dim(procspec(sicalis, opt = "smooth", span = 0.1)),
dim(procspec(sicalis, opt = "smooth", span = 30)),
dim(procspec(sicalis, opt = "smooth", span = 30))
)
expect_equal(
dim(procspec(sicalis, opt = "smooth", span = 0.1)),
dim(procspec(sicalis, opt = "smooth", span = 50))
)

Expand Down

0 comments on commit c8aec3f

Please sign in to comment.