Skip to content

Commit

Permalink
added tolerances
Browse files Browse the repository at this point in the history
  • Loading branch information
hechth committed Jul 25, 2024
1 parent 701861e commit 76beb04
Show file tree
Hide file tree
Showing 3 changed files with 5 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
5 changes: 2 additions & 3 deletions tests/testthat/test-unsupervised.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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)
},
Expand Down

0 comments on commit 76beb04

Please sign in to comment.