seaworthy.stream.matchers¶
-
class
CombinationMatcher(*matchers)[source]¶ Matcher that combines multiple input matchers.
-
class
OrderedMatcher(*matchers)[source]¶ Matcher that takes a list of matchers, and uses one after the next after each has a successful match. Returns True (“matches”) on the final match.
Note: This is a stateful matcher. Once it has done its matching, you’ll need to create a new instance.
-
class
UnorderedMatcher(*matchers)[source]¶ Matcher that takes a list of matchers, and matches each one to an item. Each item is tested against each unmatched matcher until a match is found or all unmatched matchers are checked. Returns True (“matches”) on the final match.
Note
This is a stateful matcher. Once it has done its matching, you’ll need to create a new instance.
-
to_matcher(matcher_factory, obj)[source]¶ Turn an object into a
StreamMatcherunless it already is one.Parameters: - matcher_factory – A callable capable of turning obj into a
StreamMatcher. - obj – A
StreamMatcheror an object to turn into one.
Returns: - matcher_factory – A callable capable of turning obj into a