a 4êdgt ddd¡}|j| ¡ddd| t| ¡ƒgd¢¡dS)NZQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaacbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbÚPaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbg+‡ÙÎï?rr))r ré(rr)Údeleteré)rr)r r éQréP)rrrrrrrrrrrÚtest_one_deletes ÿzTestWithAscii.test_one_deletecCsrtjdd„ddd}| |jtƒ¡tjdd„ddd}| |jdh¡tjd d„ddd}| |jdd h¡dS) NcSs|dkS©Nú r©ÚxrrrÚ!óz*TestWithAscii.test_bjunk..rZTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)ZisjunkÚaÚbcSs|dkSr$rr&rrrr(%r)zhaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb r%cSs|dvS)N)r%r+rr&rrrr()r)r+)rrrZbjunkrrrrrÚ test_bjunk s ÿ ÿ ÿzTestWithAscii.test_bjunkN)Ú__name__Ú __module__Ú __qualname__rr#r,rrrrrsrc@seZdZdZdd„ZdS)Ú TestAutojunkz-Tests for the autojunk parameter added in 2.7cCstd}d}t d||¡}|j| ¡ddd| |jdh¡tjd||dd}|j| ¡d dd| |jtƒ¡dS) NZÈbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbZÉabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbrrrr+F)ZautojunkgìQ¸…ëï?)rrrrrrr)rZseq1Zseq2rrrrÚ#test_one_insert_homogenous_sequence0sz0TestAutojunk.test_one_insert_homogenous_sequenceN)r-r.r/Ú__doc__r1rrrrr0.sr0c@s<eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd S)Ú TestSFbugscCsBt dgg¡}| | ¡d¡| | ¡d¡| | ¡d¡dS)Nr)rrrrZ quick_ratioZreal_quick_ratio)rÚsrrrÚtest_ratio_for_null_seqnAsz#TestSFbugs.test_ratio_for_null_seqncCs>t dgg¡ ¡}| tt|¡t gg¡}| tt|¡dS©N)rrZget_grouped_opcodesÚ assertRaisesÚ StopIterationÚnextÚ unified_diff)rZ group_genZdiff_genrrrÚtest_comparing_empty_listsHs z%TestSFbugs.test_comparing_empty_listscCsXt ddd¡}| ¡}| ¡}| |djd¡| |djd¡| |djd¡dS)NZabxcdZabcdrér)rrZget_matching_blocksrÚsize)rr4ÚfirstÚsecondrrrÚtest_matching_blocks_cacheOs z%TestSFbugs.test_matching_blocks_cachecCs\tt ¡ dgdg¡ƒ}| d|d¡| d|d¡| d|d¡| d |d ¡dS) Nz I am a buggyz I am a bugz- I am a buggyrz? -- rz+ I am a bugr<z? + r©rrZDifferZcomparer©rÚdiffrrrÚtest_added_tab_hintXs zTestSFbugs.test_added_tab_hintcCsLtt ¡ dgdg¡ƒ}| d|d¡| d|d¡| d|d¡dS) Nz ^z ^ z- ^rz + ^ rz ? + r<rArBrrrÚ%test_hint_indented_properly_with_tabs`sz0TestSFbugs.test_hint_indented_properly_with_tabscCs$| tt dgdgd¡ƒdg¡dS)NÚ2Ú3r))rz-2)rz+3T)rrrZ_mdiff©rrrrÚtest_mdiff_catch_stop_iterationfsþz*TestSFbugs.test_mdiff_catch_stop_iterationN) r-r.r/r5r;r@rDrErIrrrrr3@s  r3z 1. Beautiful is beTTer than ugly. 2. Explicit is better than implicit. 3. Simple is better than complex. 4. Complex is better than complicated. z™ 1. Beautiful is better than ugly. 3. Simple is better than complex. 4. Complicated is better than complex. 5. Flat is better than nested. u  1. Beautiful is beTTer than ugly. 2. Explicit is better than ımplıcıt. 3. Simple is better than complex. 4. Complex is better than complicated. uœ 1. Beautiful is better than ügly. 3. Sımple is better than complex. 4. Complicated is better than cömplex. 5. Flat is better than nested. zÛ Line 1: preceded by from:[tt] to:[ssss] Line 2: preceded by from:[sstt] to:[sssst] Line 3: preceded by from:[sstst] to:[ssssss] Line 4: has from:[sst] to:[sss] after : Line 5: has from:[t] to:[ss] at end zÞ Line 1: preceded by from:[tt] to:[ssss] Line 2: preceded by from:[sstt] to:[sssst] Line 3: preceded by from:[sstst] to:[ssssss] Line 4: has from:[sst] to:[sss] after : Line 5: has from:[t] to:[ss] at end zôline 0 1234567890123456789012345689012345 line 1 line 2 line 3 line 4 changed line 5 changed line 6 changed line 7 line 8 subtracted line 9 1234567890123456789012345689012345 short line just fits in!! just fits in two lines yup!! the endzùline 0 1234567890123456789012345689012345 line 1 line 2 added line 3 line 4 chanGEd line 5a chanGed line 6a changEd line 7 line 8 line 9 1234567890 another long line that needs to be wrapped just fitS in!! just fits in two lineS yup!! the endc@s4eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd S) Ú TestSFpatchesc!Csôtdd}tdd}d|}d|}| ¡}| ¡}| ¡}| ¡}t ¡}t ¡}t}t}t ¡} tjdd} tjdd} | j ||dd d d d } d   d| j ||dd ddd| j ||dd ddd| j ||dd ddd d| j ||dd ddd d| j ||dd ddd| j ||dd d dd| j ggdd ddd| j ggdd d dd|   ||¡d|   ||¡d| j | ¡| ¡ddd d|   | ¡| ¡¡d|   | d¡| d¡¡g¡} |   dd | ¡}t td!ƒƒ }| || ¡¡Wdƒn1sæ0YdS)"Nz(123 123 123 123 123 123 123 123 123 123 rz(456 456 456 456 456 456 456 456 456 456 r<)Útabsizeé)Z wrapcolumnÚfromÚtoFé)ÚcontextZnumlinesÚ z8

Context (first diff within numlines=5(default))

T)rPz7

Context (first diff after numlines=5(default))

z

Context (numlines=6)

éz

Context (numlines=0)

rz

Same Context

z

Same Full

z

Empty Context

z

Empty Full

z

tabsize=2

z

tabsize=default

z+

Context (wrapcolumn=14,numlines=0)

z#

wrapcolumn=14,splitlines()

z'

wrapcolumn=14,splitlines(True)

zz %s ztest_difflib_expect.html)Úpatch914575_from1Úpatch914575_to1Ú splitlinesÚpatch914575_from2Úpatch914575_to2Úpatch914575_from3Úpatch914575_to3rÚHtmlDiffÚ make_fileÚjoinZ make_tableÚreplaceÚopenrrÚread)rZf1aZt1aZf1bZt1bÚf2Út2Zf3Zt3ÚiÚjÚkÚfullZtablesÚactualÚfprrrÚtest_html_diff¾s`      æÿzTestSFpatches.test_html_diffcCsJt ¡}dd„t|dƒDƒ}dd„t|dƒDƒ}t d||¡ ¡dS)NcSs g|]}|drdpd|‘qS)r<úK:%dzV:A:%dr©Ú.0rbrrrÚ úr)z6TestSFpatches.test_recursion_limit..r<cSs g|]}|drdpd|‘qS)r<rizV:B:%drrjrrrrlûr))ÚsysÚgetrecursionlimitÚrangerrr)rÚlimitÚoldÚnewrrrÚtest_recursion_limit÷sz"TestSFpatches.test_recursion_limitcCs,t ¡}| t ¡t ¡¡}| d|¡dS)Nz"content="text/html; charset=utf-8"©rrZr[rSrUrTÚassertIn©rZ html_diffÚoutputrrrÚtest_make_file_default_charsetþs  ÿz,TestSFpatches.test_make_file_default_charsetcCs0t ¡}|jt ¡t ¡dd}| d|¡dS)Nz iso-8859-1©Úcharsetz'content="text/html; charset=iso-8859-1"rtrvrrrÚtest_make_file_iso88591_charsets  þz-TestSFpatches.test_make_file_iso88591_charsetcCs<t ¡}|jt ¡t ¡dd}| d|¡| d|¡dS)Nzus-asciiryz%content="text/html; charset=us-ascii"zımplıcıt)rrZr[Úpatch914575_nonascii_from1rUÚpatch914575_nonascii_to1rurvrrrÚ2test_make_file_usascii_charset_with_nonascii_input s þ z@TestSFpatches.test_make_file_usascii_charset_with_nonascii_inputN)r-r.r/rhrsrxr{r~rrrrrJ¼s 9rJc@s,eZdZdd„Zdd„Zdd„Zdd„Zd S) ÚTestOutputFormatcCsdgd¢}tj|ddiŽ}| t|ƒdd…ddg¡tj|ddiŽ}| t|ƒdd…dd g¡dS) N)ÚoneÚtwoÚOriginalÚCurrentz2005-01-26 23:30:50z2010-04-02 10:20:52ÚlinetermÚrr<z --- Original 2005-01-26 23:30:50z+++ Current 2010-04-02 10:20:52z *** Original 2005-01-26 23:30:50z--- Current 2010-04-02 10:20:52©rr:rrÚ context_diff©rÚargsZudZcdrrrÚtest_tab_delimitersþþz#TestOutputFormat.test_tab_delimitercCsdgd¢}tj|ddiŽ}| t|ƒdd…ddg¡tj|ddiŽ}| t|ƒdd…dd g¡dS) N)r€rr‚rƒr„r…rr<z --- Originalz +++ Currentz *** Originalz --- Currentr†rˆrrrÚ&test_no_trailing_tab_on_empty_filedate!s z7TestOutputFormat.test_no_trailing_tab_on_empty_filedatecCshd}tj}| |ddƒd¡| |ddƒd¡| |ddƒd¡| |ddƒd ¡| |d d ƒd ¡dS) Na’ Each field shall be of the form: %1d", if the range contains exactly one line, and: "%1d,%1d", , otherwise. If a range is empty, its beginning line number shall be the number of the line just before the range, or 0 if the empty range starts the file. rz3,0éÚ4rOz4,2rRz4,3rz0,0)rZ_format_range_unifiedr©rÚspecÚfmtrrrÚtest_range_format_unified)sz*TestOutputFormat.test_range_format_unifiedcCshd}tj}| |ddƒd¡| |ddƒd¡| |ddƒd¡| |ddƒd ¡| |d d ƒd ¡dS) Na The range of lines in file1 shall be written in the following format if the range contains two or more lines: "*** %d,%d **** ", , and the following format otherwise: "*** %d **** ", The ending line number of an empty range shall be the number of the preceding line, or 0 if the range is at the start of the file. Next, the range of lines in file2 shall be written in the following format if the range contains two or more lines: "--- %d,%d ---- ", , and the following format otherwise: "--- %d ---- ", rrGrŒrrOz4,5rRz4,6rÚ0)rZ_format_range_contextrrŽrrrÚtest_range_format_context:sz*TestOutputFormat.test_range_format_contextN)r-r.r/rŠr‹r‘r“rrrrrs rc@sDeZdZdd„Zdd„Zdd„Zdd„Zd d „Zd d „Zd d„Z dS)Ú TestBytescCs(t|ƒ}|D]}| |td|¡q dS)Nz.all lines of diff should be bytes, but got: %r)rZassertIsInstanceÚbytes)rrCÚlinerrrÚcheckVs þzTestBytes.checkc Cs.ddg}ddg}tj}tj}|j}|t |||¡ƒ|t |||¡ƒ|t |||dd¡ƒ|t |||dd¡ƒ|t |||dddd¡ƒ|t |||dddd¡ƒ|t |||¡ƒ|t |||¡ƒ|t |||dd¡ƒ|t |||dd¡ƒ|t |||dddd¡ƒ|t |||dddd¡ƒdS)Nóhellosandrésandréóaóbs2005s2013)rr:r‡r—Ú diff_bytes)rr*r+ÚunifiedrPr—rrrÚtest_byte_content]s"zTestBytes.test_byte_contentc sòd}d}dg}dg}ˆj}tj}tj}|t |||||¡ƒ|t |||||¡ƒ‡fdd„}gd¢} tj|||||dd } || | ƒd } d } |t |||||| | ¡ƒ|t |||||| | ¡ƒgd ¢} tj|||||| | dd } || | ƒdS) Ns³odz.txts Å‚odz.txts£odz is a city in Poland.sÅodz is a city in Poland.cs@t|ƒ}ˆ t|ƒt|ƒ¡t||ƒD]\}}ˆ ||¡q&dSr6)rrÚlenÚzip)ÚexpectrfÚer*rHrrÚ assertDiffˆsz1TestBytes.test_byte_filenames..assertDiff)s --- ³odz.txts +++ Å‚odz.txtó @@ -1 +1 @@ó-£odz is a city in Poland.ó+Åodz is a city in Poland.r))r„s 2005-03-18s 2005-03-19)s--- ³odz.txt 2005-03-18s+++ Å‚odz.txt 2005-03-19r£r¤r¥)r—rr:r‡r›) rÚfnaÚfnbr*r+r—rœrPr¢r rfÚdateaÚdatebrrHrÚtest_byte_filenamesys,   ÿzTestBytes.test_byte_filenamescCs´dg}dg}tj}tj}d}| ||||¡| ||||¡| ||||¡| ||||¡d}| |tj|||¡| |tj|||¡| |tj|||¡| |tj|||¡dS)Nr˜Zhelloz2lines to compare must be str, not bytes (b'hello')z.all arguments must be bytes, not str ('hello'))rr:r‡Ú_assert_type_errorr›)rr*r+rœrPr rrrÚtest_mixed_types_content®sz"TestBytes.test_mixed_types_contentcCs.dg}dg}d}d}| dtj||||¡dS)Nzhello zohell solé.txts olÃa9.txtz-all arguments must be str, not: b'ol\xe9.txt')r«rr:)rr*r+r¦r§rrrÚtest_mixed_types_filenamesÂs þz$TestBytes.test_mixed_types_filenamesc CsZdg}dg}d}d}| dtjtj||dd||¡ dg}d g}tt ||d d ||¡ƒdS) Nsfoo sbar u1 févu3 févu/all arguments must be bytes, not str ('1 fév')r™ršzfoo zbar r*r+)r«rr›r:r)rr*r+r¨r©rrrÚtest_mixed_types_datesÎs ýz TestBytes.test_mixed_types_datescGsL| t¡}t||ŽƒWdƒn1s,0Y| |t|jƒ¡dSr6)r7Ú TypeErrorrrÚstrÚ exception)rÚmsgÚ generatorr‰Úctxrrrr«Þs *zTestBytes._assert_type_errorN) r-r.r/r—rrªr¬r­r®r«rrrrr”Ss5 r”c@s4eZdZdd„Zdd„Zdd„Zdd„Zd d „Zd S) Ú TestJunkAPIscCs$dD]}| t |¡t|ƒ¡qdS)N)ú#z z #z# z # r…)Ú assertTruerÚ IS_LINE_JUNKÚrepr©rr–rrrÚtest_is_line_junk_trueäsz#TestJunkAPIs.test_is_line_junk_truecCs$dD]}| t |¡t|ƒ¡qdS)N)ú##z ##z## zabc zabc #zMr. Moose is up!)Ú assertFalserr¸r¹rºrrrÚtest_is_line_junk_falseèsz$TestJunkAPIs.test_is_line_junk_falsecCs ddd}| t |¡¡dS)Nú i@Br¼)r½rr¸)rZ evil_inputrrrÚtest_is_line_junk_REDOSìs z$TestJunkAPIs.test_is_line_junk_REDOScCs$dD]}| t |¡t|ƒ¡qdS)N)r%r¿)r·rÚIS_CHARACTER_JUNKr¹©rÚcharrrrÚtest_is_character_junk_trueðsz(TestJunkAPIs.test_is_character_junk_truecCs$dD]}| t |¡t|ƒ¡qdS)N)r*r¶rQú ú ú )r½rrÁr¹rÂrrrÚtest_is_character_junk_falseôsz)TestJunkAPIs.test_is_character_junk_falseN)r-r.r/r»r¾rÀrÄrÈrrrrrµãs rµc@s$eZdZdd„Zdd„Zdd„ZdS)ÚTestFindLongestcs8t‡fdd„‡‡fdd„tdtˆƒˆdƒDƒDƒƒS)Nc3s|]}|ˆvVqdSr6r)rkZb_part)r*rrÚ úr)z6TestFindLongest.longer_match_exists..cs g|]}ˆ||ˆd…‘qS)rrrj)r+Únrrrlûr)z7TestFindLongest.longer_match_exists..rr)Úanyrorž)rr*r+rËr)r*r+rËrÚlonger_match_existsùs $ÿz#TestFindLongest.longer_match_existscCs¦d}d}tj||d}| ¡}| |jd¡| |jd¡| |jd¡| ||j|j|j…||j|j|j…¡| | |||j¡¡|jddd}| |jd ¡| |jd ¡| |jd¡| ||j|j|j…||j|j|j…¡| | |dd…|dd…|j¡¡|jd d d }| |jd ¡| |jd ¡| |jd¡| ||j|j|j…||j|j|j…¡| | ||d d …|j¡¡dS)Nzfoo barz foo baz bar©r*r+rrRr<rŒ)ZaloÚblorérOr)ZbhirÏ) rrÚfind_longest_matchrr*r+r=r½rÍ©rr*r+rÚmatchrrrÚtest_default_argsýs6ÿÿ&ÿz!TestFindLongest.test_default_argscCs¢d}d}tj||d}| dt|ƒdt|ƒ¡}| |jd¡| |jd¡| |jd¡| ||j|j|j…||j|j|j…¡| |  |||j¡¡dS)NZdabcdZËddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddabcddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddrÎrécrO) rrrÑržrr*r+r=r½rÍrÒrrrÚ%test_longest_match_with_popular_charssÿz5TestFindLongest.test_longest_match_with_popular_charsN)r-r.r/rÍrÔrÖrrrrrÉøsrÉc Cs.dtj_t t¡}ttttt t t t t |ƒ dS)Nr)rrZZ_default_prefixÚdoctestZ DocTestSuiterrr0rJr3rr”rµrÉ)ZDoctestsrrrÚ test_main&s   þrØÚ__main__)rZ test.supportrrZunittestr×rmZTestCaserr0r3rSrTr|r}rVrWrXrYrJrr”rµrÉrØr-rrrrÚs0&.X?.