Skip to content
This repository has been archived by the owner on Jan 30, 2025. It is now read-only.

Commit

Permalink
Soft deprecate assert_dimensions()
Browse files Browse the repository at this point in the history
  • Loading branch information
nfrerebeau committed Nov 7, 2024
1 parent fac98ec commit b043fba
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions R/arkhe-deprecated.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# DATA CLEANING: APPEND
# DEPRECATED
#' @include assert.R
NULL

Expand All @@ -11,4 +11,7 @@ NULL

#' @export
#' @rdname arkhe-deprecated
assert_dimensions <- assert_dim
assert_dimensions <- function(x, expected) {
# .Deprecated("assert_dim()", old = "assert_dimensions()")
assert_dim(x, expected)
}
4 changes: 2 additions & 2 deletions inst/tinytest/test_assert.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ expect_identical(assert_empty(k), k)

## Dimensions ------------------------------------------------------------------
k <- matrix(1, nrow = 10, ncol = 5)
cnd <- arkhe:::catch_conditions(assert_dimensions(k, expected = c(5, 10)))
cnd <- arkhe:::catch_conditions(assert_dim(k, expected = c(5, 10)))
expect_inherits(cnd[[1]], "error_bad_dimensions")

cnd <- arkhe:::catch_conditions(assert_nrow(k, expected = 5))
Expand All @@ -77,7 +77,7 @@ expect_inherits(cnd[[1]], "error_bad_dimensions")
cnd <- arkhe:::catch_conditions(assert_ncol(k, expected = 10))
expect_inherits(cnd[[1]], "error_bad_dimensions")

expect_identical(assert_dimensions(k, expected = c(10, 5)), k)
expect_identical(assert_dim(k, expected = c(10, 5)), k)

## Names -----------------------------------------------------------------------
k <- vector(mode = "numeric", length = 10)
Expand Down

0 comments on commit b043fba

Please sign in to comment.