Skip to content
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

Provide complete grade_this_table() and grade_this_vector() functions #77

Closed
Tracked by #8
gadenbuie opened this issue Oct 18, 2021 · 0 comments · Fixed by #78
Closed
Tracked by #8

Provide complete grade_this_table() and grade_this_vector() functions #77

gadenbuie opened this issue Oct 18, 2021 · 0 comments · Fixed by #78
Assignees

Comments

@gadenbuie
Copy link
Member

If we're going to remove the idea of inconsequential differences as in #76, I think we should go all the way and even provide a grade_this_table() or grade_this_vector() function.

Following up with the comment #71 (comment) it would look something like

grade_this_table <- function(
  expr,
  correct = "Message when correct",
  incorrect = "Message when incorrect",
  ...,
  # all the arguments from tbl_grade_table() except object/expected
  max_diffs = 3,
  check_class = TRUE,
  check_names = TRUE,
  check_dimensions = TRUE,
  check_groups = TRUE,
  check_columns = TRUE,
  check_column_class = check_columns,
  check_column_values = check_columns
) {
  # expr lets users add extra checks or grading code
  
  # ... prep check env and things
  
  function(check_env) {
    grade_this({
      # pass immediately if they're *exactly* the same
      pass_if_equal(correct)
      
      # check for problems with the table
      tbl_grade_table(
        # fill in values from grade_this_table()
      )
      
      # evaluate extra checks in `expr` here
      
      # finally, fail()
      fail(incorrect)
    })
  }
}
@gadenbuie gadenbuie self-assigned this Oct 18, 2021
@rossellhayes rossellhayes linked a pull request Oct 19, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant