The current container matchers only cover list and dict (TestSlide docs). Unfortunately, this doesn't help much when I'm working with other containers or iterables (of which, Python has many!). I am proposing that we add matchers for arbitrary containers as well. Something like the following, although the names could probably be improved:
AnyIterable: value is iterable
AnyIterableContaining: asserts element exists in container/iterable
AnyIterableContainingAll: asserts container/iterable contains all elements
EmptyIterable: asserts container/iterable is empty
The current container matchers only cover
list
anddict
(TestSlide docs). Unfortunately, this doesn't help much when I'm working with other containers or iterables (of which, Python has many!). I am proposing that we add matchers for arbitrary containers as well. Something like the following, although the names could probably be improved:AnyIterable
: value is iterableAnyIterableContaining
: asserts element exists in container/iterableAnyIterableContainingAll
: asserts container/iterable contains all elementsEmptyIterable
: asserts container/iterable is emptyExample
Actual value (a
dict
ofdeque
):Since
maxlen=100
isn't a hard requirement, I don't really want to specify it in my test. It would be really great if I could test like so:See also