From 701861e3c2dc41568c892ade01738820008899c1 Mon Sep 17 00:00:00 2001 From: hechth Date: Thu, 25 Jul 2024 16:18:56 +0200 Subject: [PATCH 1/2] unuspervised test update --- tests/testthat/test-unsupervised.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/testthat/test-unsupervised.R b/tests/testthat/test-unsupervised.R index 915d294..b51e23a 100644 --- a/tests/testthat/test-unsupervised.R +++ b/tests/testthat/test-unsupervised.R @@ -13,7 +13,7 @@ patrick::with_parameters_test_that( result <- unsupervised(test_files, cluster = get_num_workers()) keys <- c("mz", "rt", "sample", "sample_rt", "sample_intensity") - actual <- result$recovered_feature_sample_table + actual <- as_tibble(result$recovered_feature_sample_table) if (store_reports) { report <- dataCompareR::rCompare( @@ -32,6 +32,8 @@ patrick::with_parameters_test_that( ) } + # arrow::write_parquet(actual, file.path("../testdata/unsupervised", paste0(.test_name, "_unsupervised_new.parquet"))) + expect_equal(actual, expected) }, patrick::cases( From 76beb04da838657668a40f2fc2b71fcc48b9d6e4 Mon Sep 17 00:00:00 2001 From: hechth Date: Thu, 25 Jul 2024 16:22:01 +0000 Subject: [PATCH 2/2] added tolerances --- tests/testthat/test-hybrid.R | 4 ++-- tests/testthat/test-prof.to.features.R | 2 +- tests/testthat/test-unsupervised.R | 5 ++--- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/testthat/test-hybrid.R b/tests/testthat/test-hybrid.R index 15e5a3b..ed28fd3 100644 --- a/tests/testthat/test-hybrid.R +++ b/tests/testthat/test-hybrid.R @@ -22,7 +22,7 @@ patrick::with_parameters_test_that("basic hybrid test", { mz_tol_relative = NA, rt_tol_relative = NA, cluster = get_num_workers()) - actual <- result$recovered_feature_sample_table + actual <- as_tibble(result$recovered_feature_sample_table) keys <- c("mz", "rt", "sample", "sample_rt", "sample_intensity") expected <- arrow::read_parquet( @@ -46,7 +46,7 @@ patrick::with_parameters_test_that("basic hybrid test", { ) } - expect_equal(actual, expected) + expect_equal(actual, expected, tolerance) }, patrick::cases( mbr = list( diff --git a/tests/testthat/test-prof.to.features.R b/tests/testthat/test-prof.to.features.R index ee809cc..da4e32e 100644 --- a/tests/testthat/test-prof.to.features.R +++ b/tests/testthat/test-prof.to.features.R @@ -22,7 +22,7 @@ patrick::with_parameters_test_that( expected_path <- file.path(testdata, "features", expected_filename) expected <- arrow::read_parquet(expected_path) - expect_equal(actual, expected) + expect_equal(actual, expected, tolerance = 0.01) }, patrick::cases( mbr_test0 = list( diff --git a/tests/testthat/test-unsupervised.R b/tests/testthat/test-unsupervised.R index b51e23a..8ebc6ea 100644 --- a/tests/testthat/test-unsupervised.R +++ b/tests/testthat/test-unsupervised.R @@ -9,8 +9,6 @@ patrick::with_parameters_test_that( test_files <- sapply(files, function(x) file.path("../testdata/input", x)) - expected <- arrow::read_parquet(file.path("../testdata/unsupervised", paste0(.test_name, "_unsupervised.parquet"))) - result <- unsupervised(test_files, cluster = get_num_workers()) keys <- c("mz", "rt", "sample", "sample_rt", "sample_intensity") actual <- as_tibble(result$recovered_feature_sample_table) @@ -32,7 +30,8 @@ patrick::with_parameters_test_that( ) } - # arrow::write_parquet(actual, file.path("../testdata/unsupervised", paste0(.test_name, "_unsupervised_new.parquet"))) + # arrow::write_parquet(actual, file.path("../testdata/unsupervised", paste0(.test_name, "_unsupervised.parquet"))) + expected <- arrow::read_parquet(file.path("../testdata/unsupervised", paste0(.test_name, "_unsupervised.parquet"))) expect_equal(actual, expected) },