Skip to content

Conversation

stibu81
Copy link
Contributor

@stibu81 stibu81 commented Sep 19, 2025

This introduces two negated expectations as suggested in #1851 with the following functionality:

  • expect_not_contains(x, y) tests that x contains none of the elements of y (i.e. y is disjoint from x).
  • expect_not_in(x, y) tests that no element of x is in y (i.e. x is disjoint from y).

While the not negated expectations actually do something different, these two are equivalent. It might still make sense to have them both.

During implementation I realised that one might have different expectations from these names. For example, one might expect that expect_not_in(x, y) checks that:

  • none of the elements of x are in y (which is what I implemented)
  • x is not a subset of y
    Both of them could also meaningfully be understood as inversions of the other two expectations. Would the second variant also be of interest?

Let me know if anything should be improved.

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 this pull request may close these issues.

1 participant