Skip to content

adding "info" to the unit test feedback #17

@smasongarrison

Description

@smasongarrison

most of the tests have additional feedback under info. it doesn't show up in the result.

test_that("Ex 1: Rmd Exercise 1 reports correct number of rows", {
skip_if(length(.rmd_content) == 0)
data("datasaurus_dozen", package = "datasauRus", envir = environment())
solution_nrow <- as.character(nrow(get("datasaurus_dozen", envir = environment())))

potential_answers <- c(solution_nrow, "nrow\(datasaurus_dozen\)", "names\(datasaurus_dozen\)")

pattern <- paste0("(", paste(potential_answers, collapse = "|"), ")")

answer_in_rmd <- stringr::str_detect(.rmd_content, pattern) |> any()

expect_equal(answer_in_rmd, TRUE,
info = "Make sure to include the number of rows in the .rmd file"
)
})

the output looks like this, but the | Failure message is blank instead of using the info

LAB11 autograding results

7 of 47 expectations passing — 15/100

  | Expectation | Failure message -- | -- | -- ☑ | ok 1 Rmd file contains headers |   ☑ | ok 2 Rmd file contains custom header elements |   ☑ | ok 3 Rmd contains a minimum number of R code chunks |   ☑ | ok 4 R code chunks contain actual code (not all empty) |   ✗ | not ok 1 Ex 1: Titanic data object exists |   ❔ | ok 2 # SKIP Reason: No Titanic data object found |   ❔ | ok 3 # SKIP Reason: No Titanic data object found |   ❔ | ok 4 # SKIP Reason: No Titanic data object found |   ❔ | ok 5 # SKIP Reason: No Titanic data object found |   ❔ | ok 6 # SKIP Reason: No Titanic data object found |   ✗ | not ok 7 Ex 1: titanic3 data object exists |   ✗ | not ok 8 Ex 1: m_apparent model object exists |   ❔ | ok 9 # SKIP Reason: m_apparent not found |   ❔ | ok 10 # SKIP Reason: m_apparent not found |   ❔ | ok 11 # SKIP Reason: m_apparent not found |   ❔ | ok 12 # SKIP Reason: p_apparent not found |   ❔ | ok 13 # SKIP Reason: m_apparent not found |   ✗ | not ok 14 Ex 10: cv_confusion data frame exists |   ❔ | ok 15 # SKIP Reason: cv_confusion not found |   ❔ | ok 16 # SKIP Reason: cv_confusion not found |   ❔ | ok 17 # SKIP Reason: cv_confusion not found |   ❔ | ok 18 # SKIP Reason: cv_confusion not found |   ❔ | ok 19 # SKIP Reason: cv_confusion not found |   ❔ | ok 20 # SKIP Reason: cv_confusion not found |   ✗ | not ok 21 Ex 10: Rmd contains confusion matrix code (TP, FP, TN, FN) |   ✗ | not ok 22 Ex 10: Rmd discusses sensitivity vs specificity trade-off |   ✗ | not ok 23 Ex 2: logistic regression model object exists |   ❔ | ok 24 # SKIP Reason: No glm model object found |   ❔ | ok 25 # SKIP Reason: No glm model object found |   ❔ | ok 26 # SKIP Reason: No glm model object found |   ❔ | ok 27 # SKIP Reason: No glm model object found |   ✗ | not ok 28 Ex 2: titanic_train data object exists |   ✗ | not ok 29 Ex 2: titanic_test data object exists |   ✗ | not ok 30 Ex 2: m_split model object exists |   ❔ | ok 31 # SKIP Reason: m_split not found |   ❔ | ok 32 # SKIP Reason: m_split not found |   ❔ | ok 33 # SKIP Reason: m_split not found |   ❔ | ok 34 # SKIP Reason: acc_test not found |   ❔ | ok 35 # SKIP Reason: acc_train not found |   ✗ | not ok 36 Ex 3: in-sample accuracy object exists |   ❔ | ok 37 # SKIP Reason: No accuracy object or glm model found |   ✗ | not ok 38 Ex 3: cross-validation results object exists |   ❔ | ok 39 # SKIP Reason: Need both in-sample and out-of-sample accuracy to compare |   ❔ | ok 40 # SKIP Reason: No cross-validation or test accuracy object found |   ✗ | not ok 41 Ex 3: titanic_cv dataset with fold variable exists |   ❔ | ok 42 # SKIP Reason: titanic_cv not found |   ✗ | not ok 43 Ex 3: cv_results data frame exists with fold and accuracy columns |   ❔ | ok 44 # SKIP Reason: cv_results not found |   ❔ | ok 45 # SKIP Reason: cv_results not found |   ❔ | ok 46 # SKIP Reason: cv_results not found |   ❔ | ok 47 # SKIP Reason: cv_results not found |   ✗ | not ok 48 Ex 4: cutoff_results data frame exists |   ❔ | ok 49 # SKIP Reason: cutoff_results not found |   ❔ | ok 50 # SKIP Reason: cutoff_results not found |   ❔ | ok 51 # SKIP Reason: cutoff_results not found |   ❔ | ok 52 # SKIP Reason: cutoff_results not found |   ❔ | ok 53 # SKIP Reason: cutoff_results_fine not found — it is created in Exercise 4.2 |   ✗ | not ok 54 Ex 4: Rmd contains cutoff analysis code |   ✗ | not ok 55 Ex 6: f_base formula object exists |   ❔ | ok 56 # SKIP Reason: f_base not found |   ❔ | ok 57 # SKIP Reason: f_base not found |   ✗ | not ok 58 Ex 6: f_expanded formula object exists |   ❔ | ok 59 # SKIP Reason: f_expanded not found |   ❔ | ok 60 # SKIP Reason: f_base not found |   ☑ | ok 61 Ex 6: Rmd justifies chosen predictors |   ✗ | not ok 62 Ex 7: cv_df dataset exists with complete cases |   ❔ | ok 63 # SKIP Reason: cv_df not found |   ❔ | ok 64 # SKIP Reason: cv_df not found |   ❔ | ok 65 # SKIP Reason: cv_df not found |   ✗ | not ok 66 Ex 7: cv_glm_accuracy function exists |   ❔ | ok 67 # SKIP Reason: cv_glm_accuracy not found |   ✗ | not ok 68 Ex 7: cv_base CV results for baseline model exist |   ✗ | not ok 69 Ex 7: cv_exp CV results for expanded model exist |   ❔ | ok 70 # SKIP Reason: cv_base not found |   ❔ | ok 71 # SKIP Reason: cv_base not found |   ❔ | ok 72 # SKIP Reason: cv_exp not found |   ✗ | not ok 73 Ex 7: summary_table comparing models exists |   ❔ | ok 74 # SKIP Reason: summary_table not found |   ❔ | ok 75 # SKIP Reason: cv_df not found |   ✗ | not ok 76 Ex 8: Rmd discusses proportion of passengers retained after listwise deletion |   ✗ | not ok 77 Ex 8: Rmd investigates who is missing (missingness analysis) |   ✗ | not ok 78 Ex 9: cv_imp CV results with imputation exist |   ❔ | ok 79 # SKIP Reason: cv_imp not found |   ❔ | ok 80 # SKIP Reason: cv_imp not found |   ❔ | ok 81 # SKIP Reason: cv_imp not found |   ❔ | ok 82 # SKIP Reason: cv_imp not found |   ✗ | not ok 83 Ex 9: Rmd contains within-fold imputation code (no leakage) |   ☑ | ok 84 Exercise 1 section contains R code |   ✗ | not ok 85 Exercise 2 section contains R code |   ☑ | ok 86 Exercise 3 section contains R code |   ✗ | not ok 87 Exercise 4 section contains cutoff analysis code |   ✗ | not ok 88 Exercise 6 section defines candidate model formulas |   ✗ | not ok 89 Exercise 7 section contains CV comparison code |   ✗ | not ok 90 Exercise 8 section discusses missingness impact |   ✗ | not ok 91 Exercise 9 section contains within-fold imputation code |   ✗ | not ok 92 Exercise 10 section contains confusion matrix code |   ✗ | not ok 93 Exercise 4 section contains cutoff analysis code |   ✗ | not ok 94 Exercise 6 section defines candidate model formulas |   ✗ | not ok 95 Exercise 7 section contains CV comparison code |   ✗ | not ok 96 Exercise 8 section discusses missingness impact |   ✗ | not ok 97 Exercise 9 section contains within-fold imputation code |   ✗ | not ok 98 Exercise 10 section contains confusion matrix code

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions