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

Allow arbitrary comparison function in expect_prop() #51

Open
gorcha opened this issue Sep 23, 2021 · 0 comments
Open

Allow arbitrary comparison function in expect_prop() #51

gorcha opened this issue Sep 23, 2021 · 0 comments
Labels
Task: Enhancement New feature or request

Comments

@gorcha
Copy link
Collaborator

gorcha commented Sep 23, 2021

Had a thought about the expect_prop() API - it would be nice to make a slight change to make the cmp argument take an arbitrary function that takes the proportion meeting the check condition and indicates whether this proportion passes some test or not. This makes it more flexible and I think reads pretty nicely.

For e.g., with a little helper function, you can do nice things like this:

expect_prop(a1, chk_blank, is_gte(0.8))

Where is_gte() is a function generator:

is_gte <- function(prop) {
  function(x) x >= prop
}
@gorcha gorcha added the Task: Enhancement New feature or request label Sep 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Task: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant