-
Notifications
You must be signed in to change notification settings - Fork 76
added is_subset_of() for testing set comparison #48
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
Conversation
|
Regarding the 98% code coverage, that was reduced by 1.5% because I added more code to the code base, but if you examine closely, you'll see my additions are covered by my unit tests. And regarding the Travis-CI error, you'll see the test cases pass 3/4 times. The one that failed was due to a failure in |
|
@mario-campos the This already works: assert_that(1).is_in(0,1,2,3)
assert_that(1).is_not_in(-1,-2,-3)Extend to lists and sets? assert_that([1,2,3]).is_in([1,2,3,4])
assert_that(set([1,2,3])).is_in(set([1,2,3,4])) |
|
Yeah, that'll work too. I'll commit some more. |
|
I tried to extend assert_that({1,2,3}).is_in({}, {1}, {1,2}, {1,2,3,4})because The same can be said for lists: does this evaluate to true or false? assert_that([1,2,3]).is_in([], [1,2], [1,2,3,4])False if you're expecting I think, by conflating |
|
@mario-campos agreed, went back to Works on anything iterable: assert_that(['a','b','c']).is_subset_of(['a','b','c','d'])
assert_that((1,2,3)).is_subset_of((1,2,3,4))
assert_that('foo').is_subset_of('abcdefghijklmnopqrstuvwxyz')
assert_that({1,2,3}).is_subset_of({1,2,3,4})And if given multiple superset args, they are flattened together: assert_that(['a','b','c']).is_subset_of('a', ['b','c'])
assert_that({1,2,3}).is_subset_of({1,2}, {3,4}) |
|
Thanks! |
Currently, the way to test for subsets is a little roundabout:
With this Pull Request, it's a bit cleaner: