+
    BiE                         R t ^ RIt^ RIHt ^ RIHt ^ RIHt  ! R R]P                  4      t	 ! R R]P                  4      t
]R	8X  d   ]P                  ! 4        R# R# )
z$Test equality and order comparisons.N)	ALWAYS_EQ)Fraction)Decimalc                      a  ] tR t^t o Rt ! R R4      t ! R R4      t^R^R]! R4      .t^.RR]! 4       .t]],           t	R t
R	 tR
 tR tR tR tR tRtV tR# )ComparisonSimpleTestz:Test equality and order comparisons for some simple cases.c                   &   a  ] tR t^t o R tRtV tR# )ComparisonSimpleTest.Emptyc                    R # )z<Empty> selfs   &(/usr/lib/python3.14/test/test_compare.py__repr__#ComparisonSimpleTest.Empty.__repr__   s        r
   N)__name__
__module____qualname____firstlineno__r   __static_attributes____classdictcell____classdict__s   @r   Emptyr      s     	 	r   r   c                   2   a  ] tR t^t o R tR tR tRtV tR# )ComparisonSimpleTest.Cmpc                    Wn         R # Narg)r   r   s   &&r   __init__!ComparisonSimpleTest.Cmp.__init__   s    Hr   c                (    R V P                   ,          # )z<Cmp %s>r   r   s   &r   r   !ComparisonSimpleTest.Cmp.__repr__   s    ((r   c                     V P                   V8H  # r   r   r   others   &&r   __eq__ComparisonSimpleTest.Cmp.__eq__   s    88u$$r   r   N)	r   r   r   r   r    r   r'   r   r   r   s   @r   Cmpr      s     		)	% 	%r   r)   g       @Nc                    V P                    F_  pV P                    FL  pWP                  9   d   W P                  9   g   WJ d   V P                  W4       K;  V P                  W4       KN  	  Ka  	  R # r   )
candidatesset1assertEqualassertNotEqualr   abs   &  r   test_comparisons%ComparisonSimpleTest.test_comparisons   sO    A__))^!yy.af$$Q*''-	 % !r   c           
         . p\        ^
4       F3  pVP                  \        V4      ^,          V P                  4       4       K5  	  V F*  pV F!  pV P	                  W48H  W4J RV: RV: 24       K#  	  K,  	  R# )
   za=z, b=N)rangeinsertlenr   r-   )r   Lir0   r1   s   &    r   test_id_comparisons(ComparisonSimpleTest.test_id_comparisons%   s`    rAHHSVQY

- A  A1FG  r   c                    V P                  ^4      pV P                  ^4      pV P                  ^4      pV P                  W8H  R4       V P                  W8g  R4       V P                  W8g  R4       R# )   TFN)r)   assertIs)r   r0   r1   cs   &   r   test_ne_defaults_to_not_eq/ComparisonSimpleTest.test_ne_defaults_to_not_eq.   sY    HHQKHHQKHHQKafd#afe$afd#r   c                   a . o ! V3R lR4      p ! V3R lR4      pV! 4       V! 4       8g   V P                  SRR.4       R# )z;object.__ne__() should allow reflected __ne__() to be triedc                   .   <a  ] tR t^9t o V3R ltRtV tR# )8ComparisonSimpleTest.test_ne_high_priority.<locals>.Leftc                 2   < SP                  R 4       \        # )Left.__eq__appendNotImplementedargscallss   *r   r'   ?ComparisonSimpleTest.test_ne_high_priority.<locals>.Left.__eq__;       ]+%%r   r
   Nr   r   r   r   r'   r   r   r   rM   s   @r   LeftrE   9        & &r   rR   c                   :   <a  ] tR t^>t o V3R ltV3R ltRtV tR# )9ComparisonSimpleTest.test_ne_high_priority.<locals>.Rightc                 2   < SP                  R 4       \        # )zRight.__eq__rH   rK   s   *r   r'   @ComparisonSimpleTest.test_ne_high_priority.<locals>.Right.__eq__?       ^,%%r   c                 2   < SP                  R 4       \        # )Right.__ne__rH   rK   s   *r   __ne__@ComparisonSimpleTest.test_ne_high_priority.<locals>.Right.__ne__B   rX   r   r
   Nr   r   r   r   r'   r[   r   r   rQ   s   @r   RightrU   >        && &r   r^   rG   rZ   NassertSequenceEqual)r   rR   r^   rM   s   &  @r   test_ne_high_priority*ComparisonSimpleTest.test_ne_high_priority6   s?    	& 	&
	& 	& 	%'  (GHr   c                   a . o ! V3R lR4      p ! V3R lRV4      pV! 4       V! 4       8g   V P                  SRR.4       R# )z4object.__ne__() should not invoke reflected __eq__()c                   .   <a  ] tR t^Kt o V3R ltRtV tR# )7ComparisonSimpleTest.test_ne_low_priority.<locals>.Basec                 2   < SP                  R 4       \        # )Base.__eq__rH   rK   s   *r   r'   >ComparisonSimpleTest.test_ne_low_priority.<locals>.Base.__eq__M   rO   r   r
   NrP   rQ   s   @r   Baserf   K   rS   r   rj   c                   :   <a  ] tR t^Pt o V3R ltV3R ltRtV tR# ):ComparisonSimpleTest.test_ne_low_priority.<locals>.Derivedc                 2   < SP                  R 4       \        # )zDerived.__eq__rH   rK   s   *r   r'   AComparisonSimpleTest.test_ne_low_priority.<locals>.Derived.__eq__Q       -.%%r   c                 2   < SP                  R 4       \        # )Derived.__ne__rH   rK   s   *r   r[   AComparisonSimpleTest.test_ne_low_priority.<locals>.Derived.__ne__T   ro   r   r
   Nr]   rQ   s   @r   Derivedrl   P   r_   r   rs   rq   rh   Nr`   )r   rj   rs   rM   s   &  @r   test_ne_low_priority)ComparisonSimpleTest.test_ne_low_priorityH   sB    	& 	&
	&d 	& 	')  )9=(IJr   c           
       a a RR 3RR 3RR 3RR 3R	R
 33pV F  w  r#S P                  V4      ;_uu_ 4        V 3R lo ! V3R lR4      pV F  w  rVWR8w  g   K  \        WES4       K  	  VR8X  d(   S P                  V! V! 4       \        4       4      R4       M$S P	                  \
        W4! 4       \        4       4       RRR4       K  	  R#   + '       g   i     K  ; i)z8No default delegation between operations except __ne__()r'   c                 
    W8H  # r   r
   r0   r1   s   &&r   <lambda><ComparisonSimpleTest.test_other_delegation.<locals>.<lambda>]       AFr   __lt__c                 
    W8  # r   r
   rx   s   &&r   ry   rz   ^       AEr   __le__c                 
    W8*  # r   r
   rx   s   &&r   ry   rz   _   r{   r   __gt__c                 
    W8  # r   r
   rx   s   &&r   ry   rz   `   r~   r   __ge__c                 
    W8  # r   r
   rx   s   &&r   ry   rz   a   r{   r   c                  *   < SP                  R 4       R# )z!Unexpected operator method calledN)fail)rL   r   s   *r   
unexpected>ComparisonSimpleTest.test_other_delegation.<locals>.unexpectede   s    IIABr   c                      < ] tR t^gt Z tRtR# )5ComparisonSimpleTest.test_other_delegation.<locals>.Cr
   N)r   r   r   r   r[   r   )r   s   r   Cr   g   s    'Fr   r   FN)subTestsetattrr?   objectassertRaises	TypeError)r   opsnamefuncr   r&   _r   s   f      @r   test_other_delegation*ComparisonSimpleTest.test_other_delegationZ   s     *+)**+)**+
 JDd##C( ( #HE}*5 !$ 8#MM$qsFH"5u=%%iqsFHE $# ###s   CA"CCc                    R  pV P                  V\        4       V P                  \        V4       \        4       pV P                  V\        4       V P                  \        V4       R# )c                      R # r   r
   r
   r   r   ry   6ComparisonSimpleTest.test_issue_1393.<locals>.<lambda>r   s    Dr   N)r-   r   r   )r   xys   &  r   test_issue_1393$ComparisonSimpleTest.test_issue_1393q   sN    I&A&HI&A&r   r
   y       @        )   )r   r   r   r   __doc__r   r)   r,   set2r+   r2   r;   rA   rb   rt   r   r   r   r   r   s   @r   r   r      sy     D % % sAtSX&DCtUW%DJ.H$I$K$F.' 'r   r   c            
         a  ] tR t^zt o Rt ! R R4      t ! R R]4      t ! R R]4      t ! R R	]4      t ! R
 R]4      t	 ! R R]4      t
 ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t ! R R]4      t]]]]	]
]]]]]3
tR tR tR,R ltR tR tR tR tR  tR! tR" tR# tR$ tR% tR& tR' tR( t R) t!R* t"R+t#V t$R# )-ComparisonFullTestzTest equality and ordering comparisons for built-in types and
user-defined classes that implement relevant combinations of rich
comparison methods.
c                       ] tR t^tRtRtR# )ComparisonFullTest.CompBasezBase class for classes with rich comparison methods.

The "x" attribute should be set to an underlying value to compare.

Derived classes have a "meth" tuple attribute listing names of
comparison methods implemented. See assert_total_order().
r
   N)r   r   r   r   r   r   r
   r   r   CompBaser      s    	r   r   c                       ] tR t^tRtRtR# )ComparisonFullTest.CompNoner
   N)r   r   r   r   methr   r
   r   r   CompNoner      s    r   r   c                   *   a  ] tR t^t o RtR tRtV tR# )ComparisonFullTest.CompEqc                4    V P                   VP                   8H  # r   r   r%   s   &&r   r'    ComparisonFullTest.CompEq.__eq__       66UWW$$r   r
   N)eq)r   r   r   r   r   r'   r   r   r   s   @r   CompEqr           	% 	%r   r   c                   *   a  ] tR t^t o RtR tRtV tR# )ComparisonFullTest.CompNec                4    V P                   VP                   8g  # r   r   r%   s   &&r   r[    ComparisonFullTest.CompNe.__ne__   r   r   r
   N)ne)r   r   r   r   r   r[   r   r   r   s   @r   CompNer      r   r   r   c                   0   a  ] tR t^t o RtR tR tRtV tR# )ComparisonFullTest.CompEqNec                4    V P                   VP                   8H  # r   r   r%   s   &&r   r'   "ComparisonFullTest.CompEqNe.__eq__   r   r   c                4    V P                   VP                   8g  # r   r   r%   s   &&r   r[   "ComparisonFullTest.CompEqNe.__ne__   r   r   r
   N)r   r   )	r   r   r   r   r   r'   r[   r   r   r   s   @r   CompEqNer           	%	% 	%r   r   c                   *   a  ] tR t^t o RtR tRtV tR# )ComparisonFullTest.CompLtc                4    V P                   VP                   8  # r   r   r%   s   &&r   r|    ComparisonFullTest.CompLt.__lt__       66EGG##r   r
   N)lt)r   r   r   r   r   r|   r   r   r   s   @r   CompLtr           	$ 	$r   r   c                   *   a  ] tR t^t o RtR tRtV tR# )ComparisonFullTest.CompGtc                4    V P                   VP                   8  # r   r   r%   s   &&r   r    ComparisonFullTest.CompGt.__gt__   r   r   r
   N)gt)r   r   r   r   r   r   r   r   r   s   @r   CompGtr      r   r   r   c                   0   a  ] tR t^t o RtR tR tRtV tR# )ComparisonFullTest.CompLtGtc                4    V P                   VP                   8  # r   r   r%   s   &&r   r|   "ComparisonFullTest.CompLtGt.__lt__   r   r   c                4    V P                   VP                   8  # r   r   r%   s   &&r   r   "ComparisonFullTest.CompLtGt.__gt__   r   r   r
   N)r   r   )	r   r   r   r   r   r|   r   r   r   r   s   @r   CompLtGtr      s     	$	$ 	$r   r   c                   *   a  ] tR t^t o RtR tRtV tR# )ComparisonFullTest.CompLec                4    V P                   VP                   8*  # r   r   r%   s   &&r   r    ComparisonFullTest.CompLe.__le__   r   r   r
   N)le)r   r   r   r   r   r   r   r   r   s   @r   CompLer      r   r   r   c                   *   a  ] tR t^t o RtR tRtV tR# )ComparisonFullTest.CompGec                4    V P                   VP                   8  # r   r   r%   s   &&r   r    ComparisonFullTest.CompGe.__ge__   r   r   r
   N)ge)r   r   r   r   r   r   r   r   r   s   @r   CompGer      r   r   r   c                   0   a  ] tR t^t o RtR tR tRtV tR# )ComparisonFullTest.CompLeGec                4    V P                   VP                   8*  # r   r   r%   s   &&r   r   "ComparisonFullTest.CompLeGe.__le__   r   r   c                4    V P                   VP                   8  # r   r   r%   s   &&r   r   "ComparisonFullTest.CompLeGe.__ge__   r   r   r
   N)r   r   )	r   r   r   r   r   r   r   r   r   r   s   @r   CompLeGer      r   r   r   c                    \        \        V4      4       Uu. uF	  q1! 4       NK  	  ppVP                  \        R7       \	        WB4       F  w  rVWen        K  	  V# u upi )a  Create objects of type `class_` and return them in a list.

`values` is a list of values that determines the value of data
attribute `x` of each object.

Objects in the returned list are sorted by their identity.  They
assigned values in `values` list order.  By assign decreasing
values to objects with increasing identities, testcases can assert
that order comparison is performed by value and not by identity.
)key)r6   r8   sortidzipr   )r   class_values__	instancesinstvalues   &&&    r   create_sorted_instances*ComparisonFullTest.create_sorted_instances   sT     ).c&k(:;(:"VX(:	;2y1KDF 2 <s   Ac                   V P                  W8H  V4       V P                  W!8H  V4       V P                  W8g  V'       * 4       V P                  W!8g  V'       * 4       V P                  \        R4      ;_uu_ 4        W8   RRR4       V P                  \        R4      ;_uu_ 4        W8*   RRR4       V P                  \        R4      ;_uu_ 4        W8   RRR4       V P                  \        R4      ;_uu_ 4        W8   RRR4       V P                  \        R4      ;_uu_ 4        W!8   RRR4       V P                  \        R4      ;_uu_ 4        W!8*   RRR4       V P                  \        R4      ;_uu_ 4        W!8   RRR4       V P                  \        R4      ;_uu_ 4        W!8   RRR4       R#   + '       g   i     EL@; i  + '       g   i     EL); i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     L; i  + '       g   i     R# ; i)zAssert equality result and that ordering is not implemented.

a, b: Instances to be tested (of same or different type).
equal: Boolean indicating the expected equality comparison results.
not supportedNr-   assertRaisesRegexr   )r   r0   r1   equals   &&&&r   assert_equality_only'ComparisonFullTest.assert_equality_only   s    	''U+U+##I??E @##I??F @##I??E @##I??F @##I??E @##I??F @##I??E @##I??F @? @???????????????????s`   9F5$G	G:G1%HH;H*&H=5G		G	G.	1H	H	H'	*H:	=I	Nc                    V P                  WW4V4       V P                  WW4V4       V P                  WW4V4       V P                  WW4V4       V P	                  WW4V4       V P                  WW4V4       R# )a  Test total ordering comparison of two instances.

a, b: Instances to be tested (of same or different type).

comp: -1, 0, or 1 indicates that the expected order comparison
   result for operations that are supported by the classes is
   a <, ==, or > b.

a_meth, b_meth: Either None, indicating that all rich comparison
   methods are available, aa for builtins, or the tuple (subset)
   of "eq", "ne", "lt", "le", "gt", and "ge" that are available
   for the corresponding instance (of a user-defined class).
N)assert_eq_subtestassert_ne_subtestassert_lt_subtestassert_le_subtestassert_gt_subtestassert_ge_subtestr   r0   r1   compa_methb_meths   &&&&&&r   assert_total_order%ComparisonFullTest.assert_total_order   sp     	qT6:qT6:qT6:qT6:qT6:qT6:r   c                    Ve   RV9   g   RV9   d1   V P                  W8H  V^ 8H  4       V P                  W!8H  V^ 8H  4       R # V P                  W8H  WJ 4       V P                  W!8H  WJ 4       R # )Nr   )r-   r  s   &&&&&&r   r   $ComparisonFullTest.assert_eq_subtest  sg    >TV^tv~QVTQY/QVTQY/QVQV,QVQV,r   c                    Ve    RR0P                  WE,           4      '       g1   V P                  W8g  V^ 8g  4       V P                  W!8g  V^ 8g  4       R # V P                  W8g  WJ4       V P                  W!8g  WJ4       R # )Nr   r   )
isdisjointr-   r  s   &&&&&&r   r   $ComparisonFullTest.assert_ne_subtest  sq    >$!8!8!I!IQVTQY/QVTQY/QVQZ0QVQZ0r   c                   Ve   RV9   g   RV9   d1   V P                  W8  V^ 8  4       V P                  W!8  V^ 8  4       R # V P                  \        R4      ;_uu_ 4        W8   R R R 4       V P                  \        R4      ;_uu_ 4        W!8   R R R 4       R #   + '       g   i     L=; i  + '       g   i     R # ; i)Nr   r   r   r   r  s   &&&&&&r   r   $ComparisonFullTest.assert_lt_subtest'      >TV^tv~QUD1H-QUD1H-''	?CC D''	?CC DC DCCCC   !BB.B+	.B?	c                   Ve   RV9   g   RV9   d1   V P                  W8*  V^ 8*  4       V P                  W!8  V^ 8*  4       R # V P                  \        R4      ;_uu_ 4        W8*   R R R 4       V P                  \        R4      ;_uu_ 4        W!8   R R R 4       R #   + '       g   i     L=; i  + '       g   i     R # ; i)Nr   r   r   r   r  s   &&&&&&r   r  $ComparisonFullTest.assert_le_subtest1      >TV^tv~QVTQY/QVTQY/''	?CC D''	?CC DC DCCCCr  c                   Ve   RV9   g   RV9   d1   V P                  W8  V^ 8  4       V P                  W!8  V^ 8  4       R # V P                  \        R4      ;_uu_ 4        W8   R R R 4       V P                  \        R4      ;_uu_ 4        W!8   R R R 4       R #   + '       g   i     L=; i  + '       g   i     R # ; i)Nr   r   r   r   r  s   &&&&&&r   r  $ComparisonFullTest.assert_gt_subtest;  r  r  c                   Ve   RV9   g   RV9   d1   V P                  W8  V^ 8  4       V P                  W!8*  V^ 8  4       R # V P                  \        R4      ;_uu_ 4        W8   R R R 4       V P                  \        R4      ;_uu_ 4        W!8*   R R R 4       R #   + '       g   i     L=; i  + '       g   i     R # ; i)Nr   r   r   r   r  s   &&&&&&r   r  $ComparisonFullTest.assert_ge_subtestE  r  r  c                v    \        4       p\        4       pV P                  WR4       V P                  WR4       R# )z#Compare instances of type 'object'.TFN)r   r   r/   s   &  r   test_objectsComparisonFullTest.test_objectsO  s0    HH!!!-!!!.r   c           
     z   V P                    EF  pV P                  V4      ;_uu_ 4        V P                  VR4      pV P                  V^ ,          V^ ,          ^ VP                  VP                  4       V P                  V^ ,          V^,          ^ VP                  VP                  4       V P                  V^ ,          V^,          RVP                  VP                  4       V P                  V^,          V^,          ^VP                  VP                  4       RRR4       EK  	  R#   + '       g   i     EK-  ; i)z5Compare same-class instances with comparison methods.N)r>      r>   )all_comp_classesr   r   r  r   )r   clsr   s   &  r   test_comp_classes_same)ComparisonFullTest.test_comp_classes_sameV  s     ((Cc"" 88iH	 ''	!ilA(+#((< ''	!ilA(+#((< ''	!ilB(+#((< ''	!ilB(+#((<% #" )"""s   C/D((D:c                   V P                    F  pV P                    F  pV P                  WR7      ;_uu_ 4        V! 4       p^Vn        V! 4       p^Vn        V! 4       p^Vn        V P                  W4^ VP                  VP                  4       V P                  W5RVP                  VP                  4       RRR4       K  	  K  	  R#   + '       g   i     K  ; i)z:Compare different-class instances with comparison methods.rx   Nr  )r   r   r   r  r   )r   cls_acls_ba1b1b2s   &     r   test_comp_classes_different.ComparisonFullTest.test_comp_classes_differento  s     **E..\\E\33BBDBBDBBD++5::uzz;++EJJ

< 43 / +333s   A;C	Cc                    ! R R\         4      p\        R4      p\        R4      pV! R4      pV! R4      pV! R4      pV P                  W"^ 4       V P                  W#R4       V P                  WD^ 4       V P                  WER4       V P                  WV^ 4       V P                  W%R4       V P                  W6^ 4       V P                  WCR4       V P                  WS^ 4       R# )z(Compare instances of str and a subclass.c                       ] tR tRtRtR# )9ComparisonFullTest.test_str_subclass.<locals>.StrSubclassi  r
   N)r   r   r   r   r   r
   r   r   StrSubclassr.    s    r   r/  r0   r1   Nr  )strr  )r   r/  s1s2c1c2c3s   &      r   test_str_subclass$ComparisonFullTest.test_str_subclass  s    	# 	 XX!,+!,+!,+!,+!,r   c                n   RpRpV P                  W^ 4       V P                  WR4       RpRpV P                  W3^ 4       V P                  W4R4       \        R^4      p\        R^4      pV P                  WU^ 4       V P                  WVR4       \        R4      p\        R4      pV P                  Ww^ 4       V P                  WxR4       Rp	Rp
V P                  WR	4       V P                  WR
4       W3W3W3W53W73WW33 F  w  rV P                  W^ 4       K  	  WWW3 F  pV P                  WR	4       K  	  R# )zCompare number types.i  i  g     H@gH@i  i  z1001.0z1001.1TFNr  y     H@        y     H@      ?)r  r   r   r   )r   i1i2f1f2q1q2d1d2r3  r4  n1n2s   &            r   test_numbersComparisonFullTest.test_numbers  sE    *+*+dAdA*+XX*+!!"$/!!"%0 w"2'B7RGLFB##BA. M2"B%%bd3 #r   c                   ^^.p^^.pV P                  W^ 4       V P                  WR4       RpRpV P                  W3^ 4       V P                  W4R4       \        ^^4      p\        ^^4      pV P                  WUR4       V P                  WVR4       V P                  W1R4       V P                  WR4       V P                  WSR4       R# )zCompare list, tuple, and range.TFNr  )r>   r  )r  r   )r  r6   r   )r   l1l2t1t2r1r2s   &      r   test_sequences!ComparisonFullTest.test_sequences  s    VV*+*+1a[1a[!!"$/!!"%0!!"%0!!"%0!!"%0r   c                Z   RpRpV P                  W^ 4       V P                  WR4       \        R4      p\        R4      pV P                  W3^ 4       V P                  W4R4       V P                  W^ 4       V P                  WR4       V P                  W1^ 4       V P                  W2R4       R# )zCompare bytes and bytearray.s   a1s   b2Nr  )r  	bytearray)r   bs1bs2ba1ba2s   &    r   
test_bytesComparisonFullTest.test_bytes  s    !,"-1-"-!,"-!,"-r   c                b   ^^0p0 RmpV P                  W^ 4       V P                  WR4       \        V4      p\        V4      pV P                  W3^ 4       V P                  W4R4       V P                  W^ 4       V P                  WR4       V P                  W1^ 4       V P                  W2R4       R# )zCompare set and frozenset.N>   r>   r  r   r  )r  	frozenset)r   r1  r2  r;  r<  s   &    r   	test_setsComparisonFullTest.test_sets  s    V*+r]r]++*+*+r   c                    ^R^R/p^R^R/p^R^R/pV P                  WR4       V P                  WR4       V P                  W#R4       R# )zCompare dict.
        r0   r1   r@   TFN)r   )r   r?  r@  d3s   &   r   test_mappings ComparisonFullTest.test_mappings  s^     aaa!!"$/!!"%0!!"$/r   r
   )NN)%r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r   r   r   r  r  r  r  r"  r*  r6  rC  rL  rT  rX  r\  r   r   r   s   @r   r   r   z   s    
 8 % %
% %
%8 %$ $
$ $
$8 $% %
% %
%8 % FHFHFH	&&6;8-1/<2<$-,"4H1*.","0 0r   r   __main__)r   unittesttest.supportr   	fractionsr   decimalr   TestCaser   r   r   mainr
   r   r   <module>re     sV    *  "  o'8,, o'd@0** @0F zMMO r   