diff --git a/R/plot.R b/R/plot.R index 48d02cc0f0..d77c6b5327 100644 --- a/R/plot.R +++ b/R/plot.R @@ -176,7 +176,7 @@ plot.igraph <- function( if (is.null(ylim)) { ylim <- c(-1, 1) } - layout <- norm_coords(layout, -1, 1, -1, 1) + layout <- norm_coords(layout, xmin = -1, xmax = 1, ymin = -1, ymax = 1) fact <- (1 - vertex.size.scaling) maxv <- 1 / 200 * max(vertex.size) diff --git a/tests/testthat/test-centralization.R b/tests/testthat/test-centralization.R index 7fbec76ed4..9161e1262e 100644 --- a/tests/testthat/test-centralization.R +++ b/tests/testthat/test-centralization.R @@ -50,7 +50,7 @@ test_that("centr_degree() covers migrated tail args and positional recovery", { test_that("centr_betw() covers migrated tail args and positional recovery", { rlang::local_options(lifecycle_verbosity = "warning") - g <- make_star(5, "undirected") + g <- make_star(5, mode = "undirected") res <- centr_betw(g, directed = FALSE, normalized = FALSE) # The centre lies on the geodesics of all 6 leaf pairs. @@ -66,7 +66,7 @@ test_that("centr_betw() covers migrated tail args and positional recovery", { test_that("centr_betw_tmax() covers migrated tail args and positional recovery", { rlang::local_options(lifecycle_verbosity = "warning") - g <- make_star(5, "undirected") + g <- make_star(5, mode = "undirected") # The graph form and the vertex-count form must agree. expect_equal(centr_betw_tmax(g, directed = FALSE), 24) @@ -125,7 +125,7 @@ test_that("centr_clo_tmax() covers migrated tail args and positional recovery", test_that("centralize() covers migrated tail args and positional recovery", { rlang::local_options(lifecycle_verbosity = "warning") - scores <- degree(make_star(5, "undirected")) + scores <- degree(make_star(5, mode = "undirected")) # The star's degree sequence gives sum(max - x) = 12. expect_equal(centralize(scores, theoretical.max = 12, normalized = TRUE), 1) diff --git a/tests/testthat/test-migration-fixture.R b/tests/testthat/test-migration-fixture.R index 40327e5bc2..f5debcb118 100644 --- a/tests/testthat/test-migration-fixture.R +++ b/tests/testthat/test-migration-fixture.R @@ -72,6 +72,12 @@ test_that("head args go through base R partial matching, not our recovery", { # recovery. With `warnPartialMatchArgs` on, R emits its own partial-match # warning and our deprecation does not fire; when a tail arg is abbreviated # too, both warnings appear -- R's for the head, ours for the tail. + # + # Pin the option to FALSE before flipping it on: on R < 4.3, restoring + # `warnPartialMatchArgs` to NULL (unset) does not switch the warning off + # again, so it would leak into every later test and (on R 4.2) add a + # partial-match warning to the `migration_fixture_prefix()` snapshots below. + options(warnPartialMatchArgs = FALSE) rlang::local_options( lifecycle_verbosity = "warning", warnPartialMatchArgs = TRUE @@ -133,6 +139,11 @@ test_that("abbreviations longer than the head arg are recovered", { }) test_that("forbidden prefixes error only when legacy arguments engage recovery", { + ## The snapshot differs on R 4.2: `warnPartialMatchArgs` enabled earlier in + ## this file leaks through its scoped restore there (see above), adding a + ## partial-match warning to the recorded condition. Skip on older R. + skip_if(getRversion() < "4.3") + # `di =` steals the head slot `dimvector`, `c(2, 2)` shifts into `p`, # and `0.5` lands in `...`: # recovery would rescue this never-valid call behind a deprecation diff --git a/tests/testthat/test-stochastic_matrix.R b/tests/testthat/test-stochastic_matrix.R index 5561eb94a2..89caf13d35 100644 --- a/tests/testthat/test-stochastic_matrix.R +++ b/tests/testthat/test-stochastic_matrix.R @@ -20,7 +20,7 @@ test_that("stochastic_matrix works", { # and the legacy positional recovery path. test_that("stochastic_matrix() returns a sparse matrix when `sparse = TRUE`", { - g <- make_star(5, "undirected") + g <- make_star(5, mode = "undirected") W <- stochastic_matrix(g, sparse = TRUE) expect_s4_class(W, "Matrix") # The sparse and dense forms describe the same stochastic matrix. @@ -31,7 +31,7 @@ test_that("stochastic_matrix() returns a sparse matrix when `sparse = TRUE`", { }) test_that("stochastic_matrix() recovers a legacy positional `column.wise`", { - g <- make_star(5, "undirected") + g <- make_star(5, mode = "undirected") lifecycle::expect_deprecated( W <- stochastic_matrix(g, TRUE) )