-
-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixes
datanames()
assignment and re-adds test for deprecated functi…
…on (#350) # Pull Request Part of #333 #### Changes description - Method was incorrectly overwriting the `teal_data` object with their own names - Adds test that will continue to test the functionality until it's removed from the framework Co-authored-by: Marcin <[email protected]>
- Loading branch information
1 parent
169180d
commit c67d840
Showing
2 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
testthat::describe("datanames deprecation: ", { | ||
testthat::it("setter does nothing to object", { | ||
td <- teal_data() |> | ||
within({ | ||
iris <- iris | ||
mtcars <- mtcars | ||
}) | ||
|
||
# ignore deprecation warnings | ||
withr::local_options(lifecycle_verbosity = "quiet") | ||
datanames(td) <- c("mtcars") | ||
|
||
testthat::expect_equal( | ||
td, | ||
teal_data() |> | ||
within({ | ||
iris <- iris | ||
mtcars <- mtcars | ||
}) | ||
) | ||
}) | ||
|
||
testthat::it("getter returns same as `names()`", { | ||
td <- teal_data() |> | ||
within({ | ||
iris <- iris | ||
mtcars <- mtcars | ||
}) | ||
|
||
# ignore deprecation warnings | ||
withr::local_options(lifecycle_verbosity = "quiet") | ||
testthat::expect_setequal(datanames(td), names(td)) | ||
}) | ||
}) |