-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #103 from mlverse/updates
Adds coverage tests
- Loading branch information
Showing
14 changed files
with
314 additions
and
52 deletions.
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
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,21 @@ | ||
# ml_formula() works | ||
|
||
Code | ||
ml_formula(am ~ mpg, mtcars) | ||
Output | ||
$label | ||
[1] "am" | ||
$features | ||
[1] "mpg" | ||
|
||
# ml_installed() works on simulated interactive session | ||
|
||
Code | ||
ml_installed(envname = test_env) | ||
Message | ||
! Required Python libraries to run ML functions are missing | ||
Could not find: torch, torcheval, and scikit-learn | ||
Do you wish to install? (This will be a one time operation) | ||
|
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,56 @@ | ||
test_that("ml_formula() works", { | ||
expect_snapshot(ml_formula(am ~ mpg, mtcars)) | ||
expect_error( | ||
ml_formula(am ~ mpg * cyl, mtcars), | ||
"Formula resulted in an invalid parameter set" | ||
) | ||
}) | ||
|
||
test_that("snake_to_camel() works", { | ||
expect_equal( | ||
snake_to_camel("var_one"), | ||
"varOne" | ||
) | ||
}) | ||
|
||
test_that("ml_connect_not_supported() works", { | ||
expect_silent( | ||
ml_connect_not_supported( | ||
args = list(), | ||
not_supported = c( | ||
"elastic_net_param", "reg_param", "threshold", | ||
"aggregation_depth", "fit_intercept", | ||
"raw_prediction_col", "uid", "weight_col" | ||
) | ||
) | ||
) | ||
|
||
expect_error( | ||
ml_connect_not_supported( | ||
args = list(reg_param = 1), | ||
not_supported = c( | ||
"elastic_net_param", "reg_param", "threshold", | ||
"aggregation_depth", "fit_intercept", | ||
"raw_prediction_col", "uid", "weight_col" | ||
), | ||
"The following argument(s) are not supported by Spark Connect:" | ||
) | ||
) | ||
}) | ||
|
||
test_that("ml_installed() works on simulated interactive session", { | ||
skip_if_not_databricks() | ||
test_env <- test_databricks_stump_env() %>% | ||
path_dir() %>% | ||
path_dir() | ||
print(test_env) | ||
local_mocked_bindings( | ||
check_interactive = function(...) TRUE, | ||
check_rstudio = function(...) TRUE, | ||
menu = function(...) return(1), | ||
py_install = function(...) invisible() | ||
) | ||
expect_snapshot( | ||
ml_installed(envname = test_env) | ||
) | ||
}) |
Oops, something went wrong.