class documentation

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

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, zero): (source)

Undocumented

Parameters
sumMatcher:Matcher[S]Undocumented
zero:SUndocumented
def describe_mismatch(self, item, description): (source)

Describe the mismatch.

Parameters
item:Sequence[S]Undocumented
description:DescriptionUndocumented
def describe_to(self, description): (source)

Describe this matcher for error messages.

Parameters
description:DescriptionUndocumented
sumMatcher = (source)

Undocumented

Undocumented

def _matches(self, item): (source)

Determine whether the sum of the sequence is matched.

Parameters
item:Sequence[S]Undocumented
Returns
boolUndocumented
def _sum(self, sequence): (source)

Undocumented

Parameters
sequence:Sequence[S]Undocumented
Returns
SUndocumented