@@ -28,7 +28,7 @@ local_mocked_s3_method <- function(
28
28
check_string(signature )
29
29
check_function(definition )
30
30
31
- old <- getS3method(generic , signature , optional = TRUE )
31
+ old <- utils :: getS3method(generic , signature , optional = TRUE )
32
32
if (is.null(old )) {
33
33
cli :: cli_abort(
34
34
" Can't find existing S3 method {.code {generic}.{signature}()}."
@@ -50,15 +50,18 @@ local_mocked_s4_method <- function(
50
50
check_character(signature )
51
51
check_function(definition )
52
52
53
- old <- getMethod(generic , signature , optional = TRUE )
53
+ old <- methods :: getMethod(generic , signature , optional = TRUE )
54
54
if (is.null(old )) {
55
55
name <- paste0(generic , " (" , paste0(signature , collapse = " ," ), " )" )
56
56
cli :: cli_abort(
57
57
" Can't find existing S4 method {.code {name}}."
58
58
)
59
59
}
60
- setMethod(generic , signature , definition , where = topenv(frame ))
61
- withr :: defer(setMethod(generic , signature , old , where = topenv(frame )), frame )
60
+ methods :: setMethod(generic , signature , definition , where = topenv(frame ))
61
+ withr :: defer(
62
+ methods :: setMethod(generic , signature , old , where = topenv(frame )),
63
+ frame
64
+ )
62
65
}
63
66
64
67
@@ -123,6 +126,9 @@ TestMockClass <- R6::R6Class(
123
126
)
124
127
)
125
128
129
+ # Silence R CMD check NOTE: I think it's because TestMockPerson is a claas
130
+ # constructor
131
+ # ' @importFrom methods new
126
132
TestMockPerson <- methods :: setClass(
127
133
" TestMockPerson" ,
128
134
slots = c(name = " character" , age = " numeric" )
0 commit comments