idXddlZddlmZddlmZmZmZmZddlm Z m Z GddZ Gdde Z Gd d e ZGd d eZGd deZdZGddeZdS)N)TestCase) Comparison TempDirectorydiffr) SampleClassA a_functionceZdZddZdZdS)AClassNc*||_|r ||_dSdSNxyselfrrs W/opt/cloudlinux/venv/lib/python3.11/site-packages/testfixtures/tests/test_comparison.py__init__zAClass.__init__ s&  DFFF  c&d|jjzdzS)N<>) __class____name__rs r__repr__zAClass.__repr__s4>**3..rr )r __module__ __qualname__rrrrr r s7 /////rr ceZdZdS)BClassNrrrrrrr r sDrr ceZdZdZdS)WeirdExceptionc"||_||_dSr r rs rrzWeirdException.__init__srNrrrrrrrr#r#s#rr#ceZdZdgZdS)XrN)rrr __slots__rrrr'r'sIIIrr'c eZdZdZdZdZdS)FussyDefineComparisonc||_dSr attr)rr-s rrzFussyDefineComparison.__init__#s  rcLt||jstdS)NF) isinstancer TypeErrorrothers r__eq__zFussyDefineComparison.__eq__&s%%00 ++ urc||k Sr rr1s r__ne__zFussyDefineComparison.__ne__+s5=  rN)rrrrr3r5rrrr*r*!sA !!!!!rr*cbt|t|}|rt|dSr )rreprAssertionError)objexpectedactuals r compare_reprr</s7 (DII & &F %V$$$%%rceZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd ZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZdZ dZ!d Z"d!Z#d"Z$d#Z%d$Z&d%Z'd&Z(d'Z)d(Z*d)Z+d*Z,d+Z-d,Z.d-Z/d.Z0d/Z1d0Z2d1Z3d2Z4d3Z5d4Z6d5Z7d6Z8d7Z9d8Z:d9Z;d:Zd=Z?d>Z@d?ZAd@ZBdAZCdBZDdCZEdDS)ETestCct}||tdtdtdf||djdd||djdd||djdddS)N'testfixtures.tests.sample1.SampleClassAz'testfixtures.tests.sample1.SampleClassBr)r assertEqualCargs)rrs r test_examplezTestC.test_example7s LL  7 8 8 7 8 8 7 8 8    11q))) 11q))) 11q)))))rc|ttddtdd|tddtdddSNrArB)rDrEr assertNotEqualrs rtest_example_with_objectzTestC.test_example_with_objectFsr  fQllOO 1aLL     1aLL 1aLL     rcn|tdddtdddSN)testfixtures.tests.test_comparison.AClassrArBr rDrEr rs rtest_example_with_varszTestC.test_example_with_varsUsK  9Q    1aLL     rcp|tddddtdddSrNrPrs rtest_example_with_odd_varsz TestC.test_example_with_odd_vars^sL  9A  1aLL     rcn|tdddtdddS)NrOrATrpartialrBrPrs rtest_example_partialzTestC.test_example_partialhsL  9    1aLL      rctd}t|t|}}||ksJt|dt|ddS)Nz some messagez,wrong typez1args: ('some message',)) ValueErrorrEr<)rerrs r.test_example_dont_use_c_wrappers_on_both_sidesz4TestC.test_example_dont_use_c_wrappers_on_both_sidespsY ~ & &ttQqTT1AvvvvQFGGGQKLLLLLrc@ttdddS)Ndatetimez r<rErs rtest_repr_modulezTestC.test_repr_modulexsQz]]N33333rc@ttdddS)Nr@z+r^rs rtest_repr_classzTestC.test_repr_class{s1Q@AAB D D D D Drc@ttdddS)Nztestfixtures.tests.sample1.zz r^rs rtest_repr_functionzTestC.test_repr_functions,Q5667 9 9 9 9 9rcZtttdddS)N somethingzBargs: ('something',)r<rErrs rtest_repr_instancezTestC.test_repr_instances5Q|K0011     rcZtttdddS)Nrez.args: ('something',))r<rErYrs rtest_repr_exceptionzTestC.test_repr_exceptions)Qz+..//1abbbbbrc\tttddddS)NrArBz args: (1, 2) x: 1 y: 2 )r<rEr#rs rtest_repr_exception_not_argsz"TestC.test_repr_exception_not_argss9 nQ"" # # E     rcPtttddiddS)NrFrAz8args: (1,)rfrs rtest_repr_class_and_varszTestC.test_repr_class_and_varss2 lVTN + + F     rc ttttttt ddddS)NrArBrzz y: z: x: 1 y: 2 )r<rErr r rs rtest_repr_nestedzTestC.test_repr_nestedsI laii1VAq\\?? ; ; ; ;     rcvtddd}|tddksJt|ddS)NrOrArBr zBwrong type)rEr r<rcs rtest_repr_failed_wrong_classz"TestC.test_repr_failed_wrong_classsS 9Q! D D DF1aLL    Q%     rcvtddd}|tddksJt|ddS)NrOmissingrprArBa attributes in Comparison but not actual: 'z': 'missing' attributes in actual but not Comparison: 'x': 1 attributes differ: 'y': 5 (Comparison) != 2 (actual) rEr r<rts r#test_repr_failed_all_reasons_in_onez)TestC.test_repr_failed_all_reasons_in_ones[ 9Y   F1aLL    QF     rcxtdddd}|tddksJt|ddS)NrOrArBrC)rrrq attributes same: ['x', 'y'] attributes in Comparison but not actual: 'z': (3,) rzrts rtest_repr_failed_not_in_otherz#TestC.test_repr_failed_not_in_others] 9Q% ! ! !F1aLL    QF     rcvtdd}|tddksJt|ddS)NrOrBrrmr z attributes same: ['y'] attributes in actual but not Comparison: 'x': (1,) rzrts rtest_repr_failed_not_in_selfz"TestC.test_repr_failed_not_in_selfsW 9Q ? ? ?FUa(((((((QF     rc|tddddd}|tddksJt|ddS) NrOrArBr}T)rrrqrVr r~rzrts r$test_repr_failed_not_in_self_partialz*TestC.test_repr_failed_not_in_self_partials^ 9Q!uVZ [ [ [FQ!$$$$$$$QF     rcvtddd}|tddksJt|ddS)NrOrA)rBr r}z attributes same: ['x'] attributes differ: 'y': (2,) (Comparison) != (3,) (actual) rzrts r(test_repr_failed_one_attribute_not_equalz.TestC.test_repr_failed_one_attribute_not_equalsV 9Q% H H HF1e$$$$$$QF     rc <ttddttttddttg}tddtddg}||kt|dt|ddS)NrArBr rCa[ attributes same: ['x'] attributes differ: 'y': 2 (Comparison) != 3 (actual) , x: x: 1 y: 2 y: ]z[, ]rEr r r<r left_side right_sides rtest_repr_failed_nestedzTestC.test_repr_failed_nestedsva(((v6Q!!4!4!4& BBBD QllF1aLL1  Z  >   & Z!788888rc xttddttttddttdg}tddttddtddg}||kt|dt|ddS) NrArBr TrU)rqa[ x: 1 y: 2 , attributes same: ['x'] attributes differ: 'y': attributes in Comparison but not actual: 'z': 2 attributes in actual but not Comparison: 'x': 1 'y': 2 (Comparison) != (actual) ]z[, ]rrs rtest_repr_failed_nested_failedz$TestC.test_repr_failed_nested_failedsva(((v6Q5556Q)))* QllVAq\\6!Q<<88:  Z  >   , Z!788888rctddd}|tddksJt|d|tddksJ|tddksJt|ddS)NrOrArBr rCz attributes same: ['x'] attributes differ: 'y': 2 (Comparison) != 3 (actual) z attributes same: ['y'] attributes differ: 'x': 1 (Comparison) != 3 (actual) rzrts rtest_repr_failed_passed_failedz$TestC.test_repr_failed_passed_failed8s 9Q! D D DF1aLL    QF   F1aLL    F1aLL    QF     rcd|tdtdSNr@)rDrErrs r test_firstzTestC.test_firstRs7  7 8 8 NN     rcd|ttddSrrDrrErs r test_secondzTestC.test_secondXs7  NN 7 8 8     rcd|tdtdSNr])rKrErrs rtest_not_same_firstzTestC.test_not_same_first^s4  jMM NN     rcd|ttddSr)rKrrErs rtest_not_same_secondzTestC.test_not_same_secondds4  NN jMM     rc|tdttddSNrArrs rtest_object_suppliedzTestC.test_object_suppliedjs>  OO l1oo       rcv|tdttddidSNrArFrmrrs rtest_class_and_varszTestC.test_class_and_varsps>  OO lVTN + +     rct|tdttddSNrArmrFrrs rtest_class_and_kwzTestC.test_class_and_kwvs=  OO l & & &     rc||tddttddiddS)NrArBrr)rDr rErs rtest_class_and_vars_and_kwz TestC.test_class_and_vars_and_kw|sE  1aLL fsAh! $ $ $     rc|tdttddidSrrrs rtest_object_and_varszTestC.test_object_and_varssB  OO lnnvtn - -     rc|tdttddSrrrs rtest_object_and_kwzTestC.test_object_and_kwsA  OO lnn4 ( ( (     rc|ttddtdddS)NrATrVrBrPrs rtest_object_partialzTestC.test_object_partialsG  fQii & & & 1aLL     rcGddt}|t|d||dS)Nc$eZdZedZdS)0TestC.run_property_equal_test..SomeClasscdSrrrs rpropz5TestC.run_property_equal_test..SomeClass.propqrNrrrpropertyrrrr SomeClassr-   X   rrrArrV)objectrDrE)rrVrs rrun_property_equal_testzTestC.run_property_equal_testsk          ia 1 1 1 IKK     rc2|ddSNFrrrs rtest_property_equalzTestC.test_property_equals $$U$33333rc2|ddSNTrrrs rtest_property_equal_partialz!TestC.test_property_equal_partials $$T$22222rcGddt}t|d|}|||t|ddS)Nc$eZdZedZdS)4TestC.run_property_not_equal_test..SomeClasscdSrrrs rrz9TestC.run_property_not_equal_test..SomeClass.proprrNrrrrrrrrrrBrz attributes differ: 'prop': 2 (Comparison) != 1 (actual) )rrErKr<)rrVrrus rrun_property_not_equal_testz!TestC.run_property_not_equal_tests         ia 1 1 1 Ayy{{+++  @ A A A A Arc2|ddSrrrs rtest_property_not_equalzTestC.test_property_not_equals (((77777rc2|ddSrrrs rtest_property_not_equal_partialz%TestC.test_property_not_equal_partials (((66666rcGddt}|}|t||j||dS)NceZdZdZdS).TestC.run_method_equal_test..SomeClasscdSr rrs rmethodz5TestC.run_method_equal_test..SomeClass.methodsrN)rrrrrrrrrs#     rrrrV)rrDrEr)rrVrinstances rrun_method_equal_testzTestC.run_method_equal_testsr        9;;  i A A A      rc2|ddSrrrs rtest_method_equalzTestC.test_method_equals ""5"11111rc2|ddSrrrs rtest_method_equal_partialzTestC.test_method_equal_partials ""4"00000rcGddt}|}t|_t|t|}|||t |ddS)NceZdZdS)2TestC.run_method_not_equal_test..SomeClassNr!rrrrrsrrrz attributes differ: 'method': (Comparison) != (actual) )rminrrEmaxrKr<)rrVrrrus rrun_method_not_equal_testzTestC.run_method_not_equal_tests}%%%%%%%%9;; iW 5 5 5 Ax(((  @     rc2|ddSrrrs rtest_method_not_equalzTestC.test_method_not_equals &&u&55555rc2|ddSrrrs rtest_method_not_equal_partialz#TestC.test_method_not_equal_partials &&t&44444rc|tdttddS)NfoorDrYrErs rtest_exceptionzTestC.test_exceptionsB  u   j      rct|tdttddS)Nrrrrrs rtest_exception_class_and_argsz#TestC.test_exception_class_and_argss?  u   jy ) ) )     rc|tdttdddS)Nrbarrrrrs r test_exception_instance_and_argsz&TestC.test_exception_instance_and_argssG  u   ji 0 0 0     rc|tdttddS)Nrr)rKrYrErs rtest_exception_not_samezTestC.test_exception_not_samesB  u   j      rc |tddttdddS)NrArBrC)rKr#rErs r test_exception_no_args_differentz&TestC.test_exception_no_args_differentsF  1a nQ"" # #     rc|ttddtdddSrJ)rDrEr#rs rtest_exception_no_args_samez!TestC.test_exception_no_args_samesF  nQ"" # # 1a      rct5}|dd}t|}|dddn #1swxYwYt d|ddd}||ksJt |ddS) Nfilestuffio.TextIOWrapperrGFTnamemodeclosedrVz attributes same: ['mode', 'name'] attributes differ: 'closed': False (Comparison) != True (actual) )rwriteopencloserEr<)rdpathfrus rtest_repr_file_differentzTestC.test_repr_file_different s __ 7768,,DT A GGIII                 t#e   AvvvvQ.     :AAAc t5}|dd}t|}|dddn #1swxYwY||t d|ddddS)NrrrrGTr)rrrrrDrE)rrrrs rtest_file_samezTestC.test_file_sames __ 7768,,DT A GGIII                  t#d        rczttd}|tksJt|ddS)NrA)r attributes in Comparison but not actual: 'x': 1 rEr'r<rts rtest_no___dict___strictzTestC.test_no___dict___strict(sK a1IIIACCxxxxQD E E E E Erct}d|_|ttdd|dS)NrATrU)r'rrDrE)rrs rtest_no___dict___partial_samez#TestC.test_no___dict___partial_same1s= CC 14000!44444rc|ttdd}|tksJt|ddS)NrATrUrr rts r%test_no___dict___partial_missing_attrz+TestC.test_no___dict___partial_missing_attr6sK a1d # # #ACCxxxxQA     rct}d|_ttddd}||ksJt|ddS)NrBrAT)rrrVz attributes in Comparison but not actual: 'y': 2 attributes differ: 'x': 1 (Comparison) != 2 (actual) )r'rrEr<)rrrus r"test_no___dict___partial_differentz(TestC.test_no___dict___partial_differentAsY CC a14 ( ( (AvvvvQA     rc@Gfdd||tk|tk|tk|tktd}|kt |ddS)Nc eZdZdZfdZdS)7TestC.test_compared_object_defines_eq..Annoyingcd|_dS)Nr eq_calledrs rrz@TestC.test_compared_object_defines_eq..Annoying.__init__Us !"rcL|xjdz c_t|rdSdS)NrATF)rr/)rr2Annoyings rr3z>TestC.test_compared_object_defines_eq..Annoying.__eq__Xs/!#eX.. 4urN)rrrrr3)rsrrrTs= # # #       rrrArz attributes differ: 'eq_called': 1 (Comparison) != 0 (actual) )rD assertFalserE assertTruer<)rrurs @rtest_compared_object_defines_eqz%TestC.test_compared_object_defines_eqPs4           XXZZ000 q{{2333  akk1222 ( xxzz1222 8 2333 h! $ $ $ XXZZ  ?     rcdttdtdksJdS)Nr)rE ImportErrorrs rtest_importerrorzTestC.test_importerrorws1S!!""k#&6&6666666rcj|tddtddS)Nz8testfixtures.tests.test_comparison.FussyDefineComparisonrAr,)rDrEr*rs r&test_class_defines_comparison_strictlyz,TestC.test_class_defines_comparison_strictlyzsG  H    !! $ $     rc td|ddS#t$rN}|t |t ||jdYd}~dSd}~wwxYw)Nztestfixtures.bonkerszNo exception raised!)z,'testfixtures.bonkers' could not be resolved)rEfail Exceptionrr/AttributeErrorrDrF)rrZs rtest_cant_resolvezTestC.test_cant_resolves . $ % % % II, - - - - -    OOJq.99 : : :   B          s( BAA;;BcGddt}d|_d|_t|}|t |ddS)NceZdZdS)"TestC.test_no_name..NoNameNr!rrrNoNamer(s Drr)z1.NoName'>>)rrrrErDr7)rr)rus r test_no_namezTestC.test_no_namesi     V    fII a"UVVVVVrcxGddt}t|ddd}||ddksJdS) NceZdZdZdS)BTestC.test_missing_expected_attribute_not_partial..MyClassc:|j|dSr __dict__updaterattrss rrzKTestC.test_missing_expected_attribute_not_partial..MyClass.__init__ $$U+++++rNr%rrrMyClassr.# , , , , ,rr6rBrCFbrurVrAar9rrrr6rus r+test_missing_expected_attribute_not_partialz1TestC.test_missing_expected_attribute_not_partialsj , , , , ,f , , , w!q% 8 8 8GGa1%%%%%%%%%rcxGddt}t|ddd}||ddksJdS) NceZdZdZdS)>TestC.test_missing_expected_attribute_partial..MyClassc:|j|dSr r0r3s rrzGTestC.test_missing_expected_attribute_partial..MyClass.__init__r5rNr%rrrr6rAr7rr6rBrCTr8rAr:r<r=s r'test_missing_expected_attribute_partialz-TestC.test_missing_expected_attribute_partialsj , , , , ,f , , , w!q$ 7 7 7GGa1%%%%%%%%%rcvGddt}t|dd}||ddksJdS)NceZdZdZdS)@TestC.test_extra_expected_attribute_not_partial..MyClassc:|j|dSr r0r3s rrzITestC.test_extra_expected_attribute_not_partial..MyClass.__init__r5rNr%rrrr6rFr7rr6rAFr;rVrBr:r<r=s r)test_extra_expected_attribute_not_partialz/TestC.test_extra_expected_attribute_not_partialsh , , , , ,f , , , w!U 3 3 3GGa1%%%%%%%%%rcvGddt}t|dd}||ddksJdS)NceZdZdZdS).MyClassc:|j|dSr r0r3s rrzETestC.test_extra_expected_attribute_partial..MyClass.__init__r5rNr%rrrr6rLr7rr6rATrHrBr:r<r=s r%test_extra_expected_attribute_partialz+TestC.test_extra_expected_attribute_partialsh , , , , ,f , , , w!T 2 2 2GGa1%%%%%%%%%rN)FrrrrHrLrQrSrWr[r_rarcrgrirkrnrrrvr{rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr r rrrrr r%r+r>rCrIrNrrrr>r>5s * * *   MMM444DDD999ccc                    999:!9!9!9F4            444333AAA 888777    222111   "666555      $   EEE555      % % % N777 . . .WWW&&&&&&&&&&&&&&rr>)sysunittestr testfixturesrrErrtestfixtures.tests.sample1rrr r r#r#rr'r*r<r>rrrrSsy IIIIIIIIIIII????????////////     V   Y  ! ! ! ! !F ! ! !%%% B &B &B &B &B &HB &B &B &B &B &r