-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closes #223 Test code clean up #248
Merged
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
d51bdd7
Closes #223 Test code clean up
sadchla-codes c71e591
Merge branch 'main' into 223_clean_test_code
sadchla-codes 7aea0b3
Merge branch 'main' into 223_clean_test_code
sadchla-codes 8dda31a
Merge branch 'main' into 223_clean_test_code
sadchla-codes 9c33499
removing magrittr where it's not necessary
sadchla-codes 0c833be
Merge branch 'main' into 223_clean_test_code
sadchla-codes 5d82e22
Order test files
sadchla-codes b247ba3
updating documentations
sadchla-codes 274c88e
Fixing the code style
sadchla-codes 2957815
fixing styler
sadchla-codes e81fda8
Merge branch 'main' into 223_clean_test_code
sadchla-codes 5e9e189
Fixing lintr indentations issues
sadchla-codes a4cfc5a
fixing Styler
sadchla-codes d2d2e81
Move package `readxl` to suggest
sadchla-codes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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,100 @@ | ||
## Test 1: xportr_df_label: deprecated metacore gives an error ---- | ||
test_that("deprecation Test 1: xportr_df_label: deprecated metacore gives an error", { | ||
local_options(lifecycle_verbosity = "quiet") | ||
df <- data.frame(x = "a", y = "b") | ||
df_meta <- data.frame(dataset = "df", label = "Label") | ||
|
||
expect_error(xportr_df_label(df, metacore = df_meta)) | ||
}) | ||
|
||
## Test 2: xportr_format: deprecated metacore gives an error ---- | ||
test_that("deprecation Test 2: xportr_format: deprecated metacore gives an error", { | ||
local_options(lifecycle_verbosity = "quiet") | ||
df <- data.frame(x = 1, y = 2) | ||
df_meta <- data.frame( | ||
dataset = "df", | ||
variable = "x", | ||
format = "date9." | ||
) | ||
|
||
expect_error(xportr_format(df, metacore = df_meta)) | ||
}) | ||
|
||
## Test 3: xportr_label: using the deprecated metacore argument gives an error ---- | ||
test_that( | ||
"deprecation Test 3: xportr_label: using the deprecated metacore argument gives an error", | ||
{ | ||
local_options(lifecycle_verbosity = "quiet") | ||
|
||
df <- data.frame(x = "a", y = "b") | ||
df_meta <- | ||
data.frame( | ||
dataset = "df", | ||
variable = "x", | ||
label = "foo" | ||
) | ||
|
||
expect_error(xportr_label(df, metacore = df_meta)) | ||
} | ||
) | ||
|
||
## Test 4: xportr_length: using the deprecated metacore argument gives an error ---- | ||
test_that( | ||
"deprecation Test 4: xportr_length: using the deprecated metacore argument gives an error", | ||
{ | ||
local_options(lifecycle_verbosity = "quiet") | ||
df <- data.frame(x = "a", y = "b") | ||
df_meta <- data.frame( | ||
dataset = "df", | ||
variable = c("x", "y"), | ||
type = c("text", "text"), | ||
length = c(1, 2) | ||
) | ||
|
||
expect_error(xportr_length(df, metacore = df_meta)) | ||
} | ||
) | ||
|
||
## Test 5: xportr_order: using the deprecated metacore argument gives an error ---- | ||
test_that( | ||
"deprecation Test 5: xportr_order: using the deprecated metacore argument gives an error", | ||
{ | ||
local_options(lifecycle_verbosity = "quiet") | ||
|
||
df <- data.frame( | ||
c = 1:5, | ||
a = "a", | ||
d = 5:1, | ||
b = LETTERS[1:5] | ||
) | ||
df_meta <- data.frame( | ||
dataset = "DOMAIN", | ||
variable = letters[1:4], | ||
order = 1:4 | ||
) | ||
|
||
expect_error(xportr_order(df, metacore = df_meta, domain = "DOMAIN")) | ||
} | ||
) | ||
|
||
## Test 6: xportr_type: using the deprecated metacore argument gives an error ---- | ||
test_that( | ||
"deprecation Test 6: xportr_type: using the deprecated metacore argument gives an error", | ||
{ | ||
local_options(lifecycle_verbosity = "quiet") | ||
df <- data.frame( | ||
Subj = as.character(c(123, 456, 789, "", NA, NA_integer_)), | ||
Different = c("a", "b", "c", "", NA, NA_character_), | ||
Val = c("1", "2", "3", "", NA, NA_character_), | ||
Param = c("param1", "param2", "param3", "", NA, NA_character_) | ||
) | ||
df_meta <- data.frame( | ||
dataset = "df", | ||
variable = c("Subj", "Param", "Val", "NotUsed"), | ||
type = c("numeric", "character", "numeric", "character"), | ||
format = NA | ||
) | ||
|
||
expect_error(xportr_type(df, metacore = df_meta)) | ||
} | ||
) |
This file was deleted.
Oops, something went wrong.
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
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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where are we using this? how come it got moved from Suggest to Imports?