
    e                     v    d dl mZ d dlmZ d dlmZ dZdZdZde	de	fd	Z
 G d
 dee	         Zde	dee	   fdZy)    )BaseMatcher)Description)MatcherzJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtstringreturnc                 z    d}d}| D ]#  }|j                         r
|s|dz  }d}||z  }d}% |j                         S )N T F)isspacestrip)r   resultlast_was_space	characters       S/usr/lib/python3/dist-packages/hamcrest/library/text/isequal_ignoring_whitespace.py
stripspacer   
   sU    FN #	!#!NiF"N# <<>    c                   4    e Zd ZddZdedefdZdeddfdZy)	IsEqualIgnoringWhiteSpacer   Nc                 h    t        |t              st        d      || _        t	        |      | _        y )Nz)IsEqualIgnoringWhiteSpace requires string)
isinstancestr	TypeErrororiginal_stringr   stripped_string)selfr   s     r   __init__z"IsEqualIgnoringWhiteSpace.__init__   s-    &#&GHH%)&1r   itemc                 T    t        |t              sy| j                  t        |      k(  S )NF)r   r   r   r   )r   r   s     r   _matchesz"IsEqualIgnoringWhiteSpace._matches   s%    $$##z$'777r   descriptionc                 X    |j                  | j                        j                  d       y )Nz ignoring whitespace)append_description_ofr   append_text)r   r    s     r   describe_toz%IsEqualIgnoringWhiteSpace.describe_to$   s"    ))$*>*>?KKLbcr   )r   N)	__name__
__module____qualname__r   r   boolr   r   r$    r   r   r   r      s0    28S 8T 8
d{ dt dr   r   c                     t        |       S )a  Matches if object is a string equal to a given string, ignoring
    differences in whitespace.

    :param string: The string to compare against as the expected value.

    This matcher first checks whether the evaluated object is a string. If so,
    it compares it with ``string``, ignoring differences in runs of whitespace.

    Example::

        equal_to_ignoring_whitespace("hello world")

    will match ``"hello   world"``.

    )r   )r   s    r   equal_to_ignoring_whitespacer+   (   s      %V,,r   N)hamcrest.core.base_matcherr   hamcrest.core.descriptionr   hamcrest.core.matcherr   
__author____copyright____license__r   r   r   r+   r)   r   r   <module>r2      sZ    2 1 )
-$s s dC 0 d - - -r   