However, AfterPreprocessing only processes the matchee, not the
matcher, so that lambda doesn't ignore whitespace in the same way as
EqualsIgnoringWhitespace does. In that respect I think
EqualsIgnoringWhitespace is less surprising.
Having said that, EqualsIgnoringWhitespace doesn't actually *ignore*
whitespace, it just treats any run of whitespace as equal in matcher
and matchee. It's misnamed, but I don't think people are going to be
surprised by its behaviour anyway.
The reason for the (str, unicode) guard is so that the assertion
doesn't fail with an AttributeError (i.e. '...' object has no
attribute 'split') when the matcher or, more significantly, the
matchee are None or some other unexpected result.
I hadn't seen AfterPreprocessing before, neat :)
However, AfterPreprocessing only processes the matchee, not the hitespace does. In that respect I think hitespace is less surprising.
matcher, so that lambda doesn't ignore whitespace in the same way as
EqualsIgnoringW
EqualsIgnoringW
Having said that, EqualsIgnoringW hitespace doesn't actually *ignore*
whitespace, it just treats any run of whitespace as equal in matcher
and matchee. It's misnamed, but I don't think people are going to be
surprised by its behaviour anyway.
The reason for the (str, unicode) guard is so that the assertion
doesn't fail with an AttributeError (i.e. '...' object has no
attribute 'split') when the matcher or, more significantly, the
matchee are None or some other unexpected result.