Skip to content

Commit

Permalink
Merge pull request #222 from RECETOX/fix_tests
Browse files Browse the repository at this point in the history
Fix tests
  • Loading branch information
hechth authored Jul 26, 2024
2 parents 4cadd1d + 76beb04 commit 978102d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests/testthat/test-hybrid.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion tests/testthat/test-prof.to.features.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 4 additions & 3 deletions tests/testthat/test-unsupervised.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,9 @@ 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 <- result$recovered_feature_sample_table
actual <- as_tibble(result$recovered_feature_sample_table)

if (store_reports) {
report <- dataCompareR::rCompare(
Expand All @@ -32,6 +30,9 @@ patrick::with_parameters_test_that(
)
}

# 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)
},
patrick::cases(
Expand Down

0 comments on commit 978102d

Please sign in to comment.