From 59c38056299931aba2625caf6cf1b8f85a74bfaf Mon Sep 17 00:00:00 2001 From: Maximilian Muecke Date: Mon, 5 Feb 2024 00:42:30 +0100 Subject: [PATCH] tests: move to testthat3 (#48) --- DESCRIPTION | 3 ++- tests/testthat/test_LearnerClust.R | 2 -- tests/testthat/test_MeasureClust.R | 2 -- tests/testthat/test_PredictionClust.R | 2 -- tests/testthat/test_TaskClust.R | 2 -- tests/testthat/test_mlr_learners_clust_agnes.R | 2 -- tests/testthat/test_mlr_learners_clust_ap.R | 2 -- tests/testthat/test_mlr_learners_clust_cmeans.R | 2 -- tests/testthat/test_mlr_learners_clust_cobweb.R | 2 -- tests/testthat/test_mlr_learners_clust_dbscan.R | 2 -- tests/testthat/test_mlr_learners_clust_dbscan_fpc.R | 2 -- tests/testthat/test_mlr_learners_clust_diana.R | 2 -- tests/testthat/test_mlr_learners_clust_em.R | 2 -- tests/testthat/test_mlr_learners_clust_fanny.R | 2 -- tests/testthat/test_mlr_learners_clust_featureless.R | 2 -- tests/testthat/test_mlr_learners_clust_ff.R | 2 -- tests/testthat/test_mlr_learners_clust_hclust.R | 2 -- tests/testthat/test_mlr_learners_clust_kkmeans.R | 2 -- tests/testthat/test_mlr_learners_clust_kmeans.R | 2 -- tests/testthat/test_mlr_learners_clust_mbatchkmeans.R | 2 -- tests/testthat/test_mlr_learners_clust_mclust.R | 2 -- tests/testthat/test_mlr_learners_clust_meanshift.R | 2 -- tests/testthat/test_mlr_learners_clust_pam.R | 2 -- tests/testthat/test_mlr_learners_clust_simplekmeans.R | 2 -- tests/testthat/test_mlr_learners_clust_xmeans.R | 2 -- 25 files changed, 2 insertions(+), 49 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 1932737f..253408c3 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -40,7 +40,7 @@ Suggests: mclust, mlbench, RWeka, - testthat + testthat (>= 3.0.0) Encoding: UTF-8 Roxygen: list(markdown = TRUE, r6 = TRUE) RoxygenNote: 7.2.3 @@ -80,3 +80,4 @@ Collate: 'bibentries.R' 'helper.R' 'zzz.R' +Config/testthat/edition: 3 diff --git a/tests/testthat/test_LearnerClust.R b/tests/testthat/test_LearnerClust.R index 87e28c16..3fc663ff 100644 --- a/tests/testthat/test_LearnerClust.R +++ b/tests/testthat/test_LearnerClust.R @@ -1,5 +1,3 @@ -context("LearnerClust") - test_that("predict on newdata works / clust", { task = tsk("usarrests")$filter(1:40) learner = lrn("clust.featureless") diff --git a/tests/testthat/test_MeasureClust.R b/tests/testthat/test_MeasureClust.R index e1d1ac27..4c39e447 100644 --- a/tests/testthat/test_MeasureClust.R +++ b/tests/testthat/test_MeasureClust.R @@ -1,5 +1,3 @@ -context("MeasureClust") - test_that("Cluster measures", { keys = mlr_measures$keys("clust") task = tsk("usarrests") diff --git a/tests/testthat/test_PredictionClust.R b/tests/testthat/test_PredictionClust.R index e2be3057..39004593 100644 --- a/tests/testthat/test_PredictionClust.R +++ b/tests/testthat/test_PredictionClust.R @@ -1,5 +1,3 @@ -context("PredictionClust") - test_that("Construction", { task = tsk("usarrests") p = PredictionClust$new(row_ids = task$row_ids, partition = rep.int(1L, nrow(task$data()))) diff --git a/tests/testthat/test_TaskClust.R b/tests/testthat/test_TaskClust.R index 17572fa0..a643ac00 100644 --- a/tests/testthat/test_TaskClust.R +++ b/tests/testthat/test_TaskClust.R @@ -1,5 +1,3 @@ -context("TaskClust") - test_that("Basic ops on usarrests task", { task = tsk("usarrests") expect_task(task) diff --git a/tests/testthat/test_mlr_learners_clust_agnes.R b/tests/testthat/test_mlr_learners_clust_agnes.R index 3aad57ae..7fafc5b0 100644 --- a/tests/testthat/test_mlr_learners_clust_agnes.R +++ b/tests/testthat/test_mlr_learners_clust_agnes.R @@ -1,5 +1,3 @@ -context("clust.agnes") - skip_if_not_installed("clue") test_that("autotest", { diff --git a/tests/testthat/test_mlr_learners_clust_ap.R b/tests/testthat/test_mlr_learners_clust_ap.R index 84bd7252..e457ad4f 100644 --- a/tests/testthat/test_mlr_learners_clust_ap.R +++ b/tests/testthat/test_mlr_learners_clust_ap.R @@ -1,5 +1,3 @@ -context("clust.ap") - skip_if_not_installed("apcluster") test_that("autotest", { diff --git a/tests/testthat/test_mlr_learners_clust_cmeans.R b/tests/testthat/test_mlr_learners_clust_cmeans.R index 572dbad8..9d22616e 100644 --- a/tests/testthat/test_mlr_learners_clust_cmeans.R +++ b/tests/testthat/test_mlr_learners_clust_cmeans.R @@ -1,5 +1,3 @@ -context("clust.cmeans") - skip_if_not_installed("e1071") test_that("autotest", { diff --git a/tests/testthat/test_mlr_learners_clust_cobweb.R b/tests/testthat/test_mlr_learners_clust_cobweb.R index 41bd66f3..2a5fcf18 100644 --- a/tests/testthat/test_mlr_learners_clust_cobweb.R +++ b/tests/testthat/test_mlr_learners_clust_cobweb.R @@ -1,5 +1,3 @@ -context("clust.cobweb") - skip_if_not_installed("RWeka") skip_on_cran() diff --git a/tests/testthat/test_mlr_learners_clust_dbscan.R b/tests/testthat/test_mlr_learners_clust_dbscan.R index b22a4332..f09e2a46 100644 --- a/tests/testthat/test_mlr_learners_clust_dbscan.R +++ b/tests/testthat/test_mlr_learners_clust_dbscan.R @@ -1,5 +1,3 @@ -context("clust.dbscan") - skip_if_not_installed("dbscan") test_that("autotest", { diff --git a/tests/testthat/test_mlr_learners_clust_dbscan_fpc.R b/tests/testthat/test_mlr_learners_clust_dbscan_fpc.R index 9d83e7ee..742a5039 100644 --- a/tests/testthat/test_mlr_learners_clust_dbscan_fpc.R +++ b/tests/testthat/test_mlr_learners_clust_dbscan_fpc.R @@ -1,5 +1,3 @@ -context("clust.dbscan_fpc") - skip_if_not_installed("fpc") test_that("autotest", { diff --git a/tests/testthat/test_mlr_learners_clust_diana.R b/tests/testthat/test_mlr_learners_clust_diana.R index 0191f6e6..d667963d 100644 --- a/tests/testthat/test_mlr_learners_clust_diana.R +++ b/tests/testthat/test_mlr_learners_clust_diana.R @@ -1,5 +1,3 @@ -context("clust.diana") - skip_if_not_installed("clue") test_that("autotest", { diff --git a/tests/testthat/test_mlr_learners_clust_em.R b/tests/testthat/test_mlr_learners_clust_em.R index 5243ae49..f9b607c0 100644 --- a/tests/testthat/test_mlr_learners_clust_em.R +++ b/tests/testthat/test_mlr_learners_clust_em.R @@ -1,5 +1,3 @@ -context("clust.em") - skip_if_not_installed("RWeka") skip_on_cran() diff --git a/tests/testthat/test_mlr_learners_clust_fanny.R b/tests/testthat/test_mlr_learners_clust_fanny.R index 6eb56e6e..31ff15f0 100644 --- a/tests/testthat/test_mlr_learners_clust_fanny.R +++ b/tests/testthat/test_mlr_learners_clust_fanny.R @@ -1,5 +1,3 @@ -context("clust.fanny") - skip_if_not_installed("clue") test_that("autotest", { diff --git a/tests/testthat/test_mlr_learners_clust_featureless.R b/tests/testthat/test_mlr_learners_clust_featureless.R index 019730f9..f1731e68 100644 --- a/tests/testthat/test_mlr_learners_clust_featureless.R +++ b/tests/testthat/test_mlr_learners_clust_featureless.R @@ -1,5 +1,3 @@ -context("mlr_learners_clust_featureless") - test_that("autotest", { learner = lrn("clust.featureless") expect_learner(learner) diff --git a/tests/testthat/test_mlr_learners_clust_ff.R b/tests/testthat/test_mlr_learners_clust_ff.R index 9cd1a248..fcdf20ab 100644 --- a/tests/testthat/test_mlr_learners_clust_ff.R +++ b/tests/testthat/test_mlr_learners_clust_ff.R @@ -1,5 +1,3 @@ -context("clust.ff") - skip_if_not_installed("RWeka") skip_on_cran() diff --git a/tests/testthat/test_mlr_learners_clust_hclust.R b/tests/testthat/test_mlr_learners_clust_hclust.R index eac5da54..20272dba 100644 --- a/tests/testthat/test_mlr_learners_clust_hclust.R +++ b/tests/testthat/test_mlr_learners_clust_hclust.R @@ -1,5 +1,3 @@ -context("clust.hclust") - test_that("autotest", { learner = mlr3::lrn("clust.hclust") expect_learner(learner) diff --git a/tests/testthat/test_mlr_learners_clust_kkmeans.R b/tests/testthat/test_mlr_learners_clust_kkmeans.R index e93ee5d3..3671d072 100644 --- a/tests/testthat/test_mlr_learners_clust_kkmeans.R +++ b/tests/testthat/test_mlr_learners_clust_kkmeans.R @@ -1,5 +1,3 @@ -context("clust.kkmeans") - skip_if_not_installed("kernlab") test_that("autotest", { diff --git a/tests/testthat/test_mlr_learners_clust_kmeans.R b/tests/testthat/test_mlr_learners_clust_kmeans.R index 276f0014..039468df 100644 --- a/tests/testthat/test_mlr_learners_clust_kmeans.R +++ b/tests/testthat/test_mlr_learners_clust_kmeans.R @@ -1,5 +1,3 @@ -context("clust.kmeans") - skip_if_not_installed("clue") test_that("autotest", { diff --git a/tests/testthat/test_mlr_learners_clust_mbatchkmeans.R b/tests/testthat/test_mlr_learners_clust_mbatchkmeans.R index be86cf0f..c25f7810 100644 --- a/tests/testthat/test_mlr_learners_clust_mbatchkmeans.R +++ b/tests/testthat/test_mlr_learners_clust_mbatchkmeans.R @@ -1,5 +1,3 @@ -context("clust.MBatchKMeans") - skip_if_not_installed("ClusterR") test_that("autotest", { diff --git a/tests/testthat/test_mlr_learners_clust_mclust.R b/tests/testthat/test_mlr_learners_clust_mclust.R index 78b34b12..6508696b 100644 --- a/tests/testthat/test_mlr_learners_clust_mclust.R +++ b/tests/testthat/test_mlr_learners_clust_mclust.R @@ -1,5 +1,3 @@ -context("clust.mclust") - skip_if_not_installed("mclust") test_that("autotest", { diff --git a/tests/testthat/test_mlr_learners_clust_meanshift.R b/tests/testthat/test_mlr_learners_clust_meanshift.R index 84f74ac6..a1a6ed47 100644 --- a/tests/testthat/test_mlr_learners_clust_meanshift.R +++ b/tests/testthat/test_mlr_learners_clust_meanshift.R @@ -1,5 +1,3 @@ -context("clust.meanshift") - skip_if_not_installed("LPCM") test_that("autotest", { diff --git a/tests/testthat/test_mlr_learners_clust_pam.R b/tests/testthat/test_mlr_learners_clust_pam.R index 197cb637..bf21dee0 100644 --- a/tests/testthat/test_mlr_learners_clust_pam.R +++ b/tests/testthat/test_mlr_learners_clust_pam.R @@ -1,5 +1,3 @@ -context("clust.pam") - skip_if_not_installed("clue") test_that("autotest", { diff --git a/tests/testthat/test_mlr_learners_clust_simplekmeans.R b/tests/testthat/test_mlr_learners_clust_simplekmeans.R index 6f2e69ce..3676bff6 100644 --- a/tests/testthat/test_mlr_learners_clust_simplekmeans.R +++ b/tests/testthat/test_mlr_learners_clust_simplekmeans.R @@ -1,5 +1,3 @@ -context("clust.SimpleKMeans") - skip_if_not_installed("RWeka") skip_on_cran() diff --git a/tests/testthat/test_mlr_learners_clust_xmeans.R b/tests/testthat/test_mlr_learners_clust_xmeans.R index be0159d4..b21619e0 100644 --- a/tests/testthat/test_mlr_learners_clust_xmeans.R +++ b/tests/testthat/test_mlr_learners_clust_xmeans.R @@ -1,5 +1,3 @@ -context("clust.xmeans") - skip_on_cran() skip_if_not_installed("RWeka")