Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/plot.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions tests/testthat/test-centralization.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
11 changes: 11 additions & 0 deletions tests/testthat/test-migration-fixture.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions tests/testthat/test-stochastic_matrix.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
)
Expand Down
Loading