class documentation

class _MatchAfter(BaseMatcher[_A]):

Constructor: _MatchAfter(f, m)

View In Hierarchy

The implementation of after.

Method __init__ Undocumented
Method describe_mismatch Describe the mismatching item or the exception that occurred while pre-processing it.
Method describe_to Create a text description of the match requirement.
Instance Variable f The function to apply.
Instance Variable m The matcher to use on the result.
Method _matches Apply the function and delegate matching on the result.
Instance Variable _e After trying to apply the function fails with an exception, the exception that was raised. This can later be used by describe_mismatch.
def __init__(self, f: Callable[[_A], _B], m: Matcher[_B]):

Undocumented

def describe_mismatch(self, item: _A, mismatch_description: Description):

Describe the mismatching item or the exception that occurred while pre-processing it.

Note
Since the exception reporting here depends on mutable state it will only work as long as PyHamcrest calls methods in the right order. The PyHamcrest Matcher interface doesn't seem to allow implementing this functionality in a more reliable way (see the implementation of assert_that).
def describe_to(self, description: Description):

Create a text description of the match requirement.

f =

The function to apply.

m =

The matcher to use on the result.

def _matches(self, item: _A) -> bool:

Apply the function and delegate matching on the result.

_e: Exception | None =

After trying to apply the function fails with an exception, the exception that was raised. This can later be used by describe_mismatch.