class documentation

class HasSum(BaseMatcher[Sequence[S]]):

Constructor: HasSum(sumMatcher, zero)

View In Hierarchy

Match a sequence the elements of which sum to a value matched by another matcher.

:ivar sumMatcher: The matcher which must match the sum. :ivar zero: The zero value for the matched type.

Method __init__ Undocumented
Method describe_mismatch Describe the mismatch.
Method describe_to Describe this matcher for error messages.
Instance Variable sumMatcher Undocumented
Instance Variable zero Undocumented
Method _matches Determine whether the sum of the sequence is matched.
Method _sum Undocumented
def __init__(self, sumMatcher: Matcher[S], zero: S):

Undocumented

def describe_mismatch(self, item: Sequence[S], description: Description):

Describe the mismatch.

def describe_to(self, description: Description):

Describe this matcher for error messages.

sumMatcher =

Undocumented

zero =

Undocumented

def _matches(self, item: Sequence[S]) -> bool:

Determine whether the sum of the sequence is matched.

def _sum(self, sequence: Sequence[S]) -> S:

Undocumented