a ze1@sBddlZddlmZddlZGdddejZedkr>edS)N)supportc@seZdZddZddZddZddZd d Zd d Zd dZ ddZ ddZ ddZ ddZ ddZddZddZddZdd Zd!d"Zd#d$Zd%d&Zd'd(Zd)d*Zd+d,Zd-d.Zd/d0Zd1d2Zd3d4Zd5d6Zd7d8Zd9S):BoolTestcCsHzGdddt}Wnty&Yn 0|d|ttjtddS)Nc@s eZdZdS)z!BoolTest.test_subclass..CN)__name__ __module__ __qualname__rrB/opt/bitninja-python-dojo/embedded/lib/python3.9/test/test_bool.pyC sr zbool should not be subclassabler)bool TypeErrorZfail assertRaisesint__new__)selfr rrr test_subclass s   zBoolTest.test_subclassc Cszttjd}tdd|dWdn1s20Yttjd }||dWdn1sn0YWttjnttj0dS)NwFT)filerz False True )openrTESTFNprint assertEqualreadosremove)rfofirrr test_prints ,0zBoolTest.test_printcCsL|tdd|tdd|ttdd|ttdddSNFFalseTTrue)rreprevalrrrr test_reprszBoolTest.test_reprcCs$|tdd|tdddSr)rstrr#rrrtest_str$szBoolTest.test_strcCsD|tdd|tdd|tdd|tdddS)NFrT)rr assertIsNotr#rrrtest_int(szBoolTest.test_intcCsD|tdd|tdd|tdd|tdddS)NFT?)rfloatr(r#rrr test_float.szBoolTest.test_floatc Cs*|dd|dd|dd|dd|tdd|tdd|dd|dd|dd|tdd|tdd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|dd|d d|d d|d d|d d|dd|dd|dd|dd|dd|ddd D]F}d D]:}|||t|||||tt||q,q$d D] }d D]}|||@tt|t|@|||Btt|t|B|||Att|t|A||t|@t|t|@||t|@tt|t|@||t|Bt|t|B||t|Btt|t|B||t|At|t|A||t|Att|t|A|t||@t|t|@|t||@tt|t|@|t||Bt|t|B|t||Btt|t|B|t||At|t|A|t||Att|t|Aqzqp|ddkd|ddkd|ddkd|ddkd|ddkd|ddkd|ddkd|ddkd|ddkd|ddkd|ddkd|ddkddg}|||ud|||ud|d|vd|d|vd|d|vd|d|vdddi}|||ud|||ud|d|vd|d|vd|d|vd|d|vd|dd|dddS) NrFr'Tr+r*)FT)rr'r0)rr(absr r assertIs)rbiaxrrr test_math4s                                        $      $ $ $ $ $ , zBoolTest.test_mathcCs|ttdd|tdd|tdd|tdd|tdd|tdd|td d|tddS) N* Tr'r.rFZhello)r r r r3r#rrr test_convertszBoolTest.test_convertcCs:|tdtddWdn1s,0YdS)Nzkeyword argumentr:)r7)ZassertRaisesRegexr r r#rrrtest_keyword_argsszBoolTest.test_keyword_argscCsD|ddd|ddd|ddd|ddddS)Nz%dF0T1z%x)rr#rrr test_formatszBoolTest.test_formatcCs(|tgdd|tgdddS)NappendTZwobbleF)r3hasattrr#rrr test_hasattrszBoolTest.test_hasattrcCs$|ttd|tdddS)NTr'F)r3callablelenr#rrr test_callableszBoolTest.test_callablecCsp|tdtd|tdtd|tdtd|tdtd|tdtd|tdtddS)NTFr'r)r3 isinstancer r r#rrrtest_isinstances zBoolTest.test_isinstancecCs(|tttd|tttddS)NTF)r3 issubclassr r r#rrrtest_issubclassszBoolTest.test_issubclasscCs(|divd|dddivddS)Nr'FT)r3r#rrr test_containsszBoolTest.test_containscCs|ddd|ddd|dd|dd|dd|dd|dd|dd|dd|d d|dd|dd|dd|dd|d d|d d|d d|d d|d d|d d|d d|d d|d dd|d dddS)NZxyzzTr7FZxyz0123z@#$%Z0123ZXYZ  u X) r3endswithisalnumisalphaisdigitislower isdecimal isnumericisspaceistitleisupper startswithr#rrr test_strings0zBoolTest.test_stringcCsp|dd|dt|dd|dd|dt|dd|dd|dt|dddS)Nr'TrF)rZassertNotIsInstancer r3r#rrr test_booleans        zBoolTest.test_booleanc CslzXttjd}||jdWdn1s20Y||jdWttjnttj0dS)NrFT)rrrr3closedrr)rfrrrtest_filecloseds ,zBoolTest.test_fileclosedc Cs4tttttttttt t f D]}| t|dqdS)NT) r complexdictr,r listobjectsetr%tupletyper3)rtrrr test_typesszBoolTest.test_typescCsddl}||dd||dd||dd||dd||gdd||dgdd||ddd||ddd||ddd||ddd||ddd||ddddS)NrFr'T)operatorr3truthnot_containsltis_is_not)rrirrr test_operatorszBoolTest.test_operatorcCs<ddl}|||dd|||dddS)NrTF)marshalr3loadsdumps)rrqrrr test_marshalszBoolTest.test_marshalc CsTddl}t|jdD]8}|||d|d|||d|dqdS)Nrr'TF)picklerangeHIGHEST_PROTOCOLr3rrrs)rruprotorrr test_pickleszBoolTest.test_picklecCsddl}||jdddd||jdddd||jdddd||jdddd||jdddd ||jdddd dS) NrT)protocolsI01 .FsI00 .r'r0s.s.)rurrs)rrurrrtest_picklevaluesszBoolTest.test_picklevaluescsfdd}Gdddt}||Gdddt}||Gdddt}||Gd d d t}||Gd d d }tt|dS) Ncstt|SNr r r )or#rr*z/BoolTest.test_convert_to_bool..c@seZdZddZdS)z*BoolTest.test_convert_to_bool..FoocSs|Sr|rr#rrr__bool__,sz3BoolTest.test_convert_to_bool..Foo.__bool__NrrrrrrrrFoo+src@seZdZddZdS)z*BoolTest.test_convert_to_bool..BarcSsdS)NZYesrr#rrrr1sz3BoolTest.test_convert_to_bool..Bar.__bool__NrrrrrBar0src@seZdZddZdS)z*BoolTest.test_convert_to_bool..BazcSs|Sr|rr#rrrr6sz3BoolTest.test_convert_to_bool..Baz.__bool__NrrrrrBaz5src@seZdZddZdS)z+BoolTest.test_convert_to_bool..SpamcSsdS)Nr'rr#rrrr<sz4BoolTest.test_convert_to_bool..Spam.__bool__NrrrrrSpam;src@seZdZddZdS)z+BoolTest.test_convert_to_bool..EggscSsdS)Nr.rr#rrr__len__Asz3BoolTest.test_convert_to_bool..Eggs.__len__NrrrrrrrrEggs@sr)rcr r ValueErrorr )rcheckrrrrrrr#rtest_convert_to_bool&s     zBoolTest.test_convert_to_boolcCs,|tddd|tddddS)NsbigFsabcdlittleT)r3r from_bytesr#rrrtest_from_bytesEszBoolTest.test_from_bytescsdD]Gfddd}zt|Wqty}zTzt|Wn8ty~}z |t|t|WYd}~n d}~00WYd}~qd}~00qdS)N)Zillegalr.lcseZdZfddZdS)z!BoolTest.test_sane_len..AcsSr|rr#ZbadvalrrrNsz)BoolTest.test_sane_len..A.__len__NrrrrrAMsr)r ExceptionrErr%)rrZe_boolZe_lenrrr test_sane_lenIszBoolTest.test_sane_lencCs@Gddd}|tt|Gddd}|tt|dS)Nc@seZdZdZdS)z BoolTest.test_blocked..ANrrrrrrYsrc@seZdZddZdZdS)z BoolTest.test_blocked..BcSsdS)Nr:rr#rrrr^sz(BoolTest.test_blocked..B.__len__N)rrrrrrrrrB]srr})rrrrrr test_blockedXszBoolTest.test_blockedcCs|djd|djd|tdjt|tdjt|djd|djd|tdjt|tdjtdS)NTr'rF)rrealimagr3rfr r#rrrtest_real_and_imagcszBoolTest.test_real_and_imagN)rrrrrr$r&r)r-r8r<r=r@rCrFrHrJrKr[r\r_rhrprtryr{rrrrrrrrrrs8  m    r__main__)ZunittesttestrrZTestCaserrmainrrrrs h