
    9bh                     f    d dl mZmZ  G d d      Z G d d      Z G d d      Z G d d	e      Zy
)    )copysignisnanc                   L    e Zd Zd
dZd
dZd
dZd
dZd
dZd
dZd
dZ	d
d	Z
y)ExtraAssertionsNc                 n    t        ||      ry |d|}| j                  | j                  ||             y )Nz is not a subclass of 
issubclassfail_formatMessageselfcls
superclassmsgstandardMsgs        ?/opt/python-3.12.12/usr/lib/python3.12/test/support/testcase.pyassertIsSubclassz ExtraAssertions.assertIsSubclass   s9    c:&5j^D		$%%c;78    c                 n    t        ||      sy |d|}| j                  | j                  ||             y )Nz is a subclass of r   r   s        r   assertNotIsSubclassz#ExtraAssertions.assertNotIsSubclass   s9    #z*1*@		$%%c;78r   c                 4   t        ||      st        |t        j                        rd|j                  d|}n=t        |t
              rd|j                  d|}nt        |      j                  d|}| j                  | j                  ||             y y )Nmodule z has no attribute type object z object has no attribute hasattr
isinstancetypes
ModuleType__name__typer
   r   r   objnamer   r   s        r   assertHasAttrzExtraAssertions.assertHasAttr   s    sD!#u//0 ''77I$RC& ,S\\,<<NthW!%c!3!3 66OPTxXIId))#{;< "r   c                 4   t        ||      rt        |t        j                        rd|j                  d|}n=t        |t
              rd|j                  d|}nt        |      j                  d|}| j                  | j                  ||             y y )Nr   z has unexpected attribute r   z! object has unexpected attribute r   r!   s        r   assertNotHasAttrz ExtraAssertions.assertNotHasAttr   s    3#u//0 ''77QRVQYZC& ,S\\,<<VW[V^_!%c!3!3 66WX\W_`IId))#{;< r   c                 x    |j                  |      ry |d|}| j                  | j                  ||             y )Nz doesn't start with 
startswithr
   r   )r   sprefixr   r   s        r   assertStartsWithz ExtraAssertions.assertStartsWith&   s;    <<1&<		$%%c;78r   c                 t    |j                  |      sy | j                  | j                  ||d|             y )Nz starts with r(   )r   r*   r+   r   s       r   assertNotStartsWithz#ExtraAssertions.assertNotStartsWith,   s5    ||F#		$%%caU-z+JKLr   c                 x    |j                  |      ry |d|}| j                  | j                  ||             y )Nz doesn't end with endswithr
   r   )r   r*   suffixr   r   s        r   assertEndsWithzExtraAssertions.assertEndsWith1   s;    ::f/z:		$%%c;78r   c                 t    |j                  |      sy | j                  | j                  ||d|             y )Nz ends with r0   )r   r*   r2   r   s       r   assertNotEndsWithz!ExtraAssertions.assertNotEndsWith7   s5    zz&!		$%%caU+fZ+HIJr   )N)r   
__module____qualname__r   r   r$   r&   r,   r.   r3   r5    r   r   r   r      s,    99==9M
9Kr   r   c                       e Zd Zd Zy)ExceptionIsLikeMixinc                 ^   ||y|| j                  d|        || j                  d|d       t        |t              sS| j                  |j                  |j                         | j                  |j
                  d   |j
                  d          y| j                  |j                  |j                         | j                  t        |j                        t        |j                               t        |j                  |j                        D ]  \  }}| j                  ||        y)a	  
        Passes when the provided `exc` matches the structure of `template`.
        Individual exceptions don't have to be the same objects or even pass
        an equality test: they only need to be the same type and contain equal
        `exc_obj.args`.
        Nzunexpected exception: zexpected an exception like z
, got Noner   )r
   r   ExceptionGroupassertEqual	__class__argsmessagelen
exceptionszipassertExceptionIsLike)r   exctemplateets        r   rD   z*ExceptionIsLikeMixin.assertExceptionIsLike>   s     ;8+II.se45;II3H<zJK#~.S]]H,>,>?SXXa[(--*:;S[[(*:*:;S0#h6I6I2JKCNNH,?,?@1**1a0 Ar   N)r   r6   r7   rD   r8   r   r   r:   r:   =   s    1r   r:   c                       e Zd Zd Zy)FloatsAreIdenticalMixinc                     d}t        |      st        |      rt        |      r6t        |      r+y||k(  r%|dk7  ryt        d|      t        d|      k(  ry|dz  }| j                  |j                  ||             y)a#  Fail unless floats x and y are identical, in the sense that:
        (1) both x and y are nans, or
        (2) both x and y are infinities, with the same sign, or
        (3) both x and y are zeros, with the same sign, or
        (4) x and y are both finite and nonzero, and x == y

        z&floats {!r} and {!r} are not identicalNg        g      ?z: zeros have different signs)r   r   r
   format)r   xyr   s       r   assertFloatsAreIdenticalz0FloatsAreIdenticalMixin.assertFloatsAreIdenticalY   sr     78uQxQxE!H!VCx#q!Xc1%5555		#**Q"#r   N)r   r6   r7   rO   r8   r   r   rJ   rJ   X   s    $r   rJ   c                       e Zd Zd Zy)ComplexesAreIdenticalMixinc                     | j                  |j                  |j                         | j                  |j                  |j                         y)zFail unless complex numbers x and y have equal values and signs.

        In particular, if x and y both have real (or imaginary) part
        zero, but the zeros have different signs, this test will fail.

        N)rO   realimag)r   rM   rN   s      r   assertComplexesAreIdenticalz6ComplexesAreIdenticalMixin.assertComplexesAreIdenticalr   s4     	%%affaff5%%affaff5r   N)r   r6   r7   rU   r8   r   r   rQ   rQ   q   s    6r   rQ   N)mathr   r   r   r:   rJ   rQ   r8   r   r   <module>rW      s6     6K 6Kr1 16$ $2	6!8 	6r   