ó {G_Tc@s ddlZddlmZmZddlZddlZddlZdejfd„ƒYZdejfd„ƒYZ dejfd„ƒYZ d Z d Z d Z d Zd ZdZdejfd„ƒYZdejfd„ƒYZd„ZedkreƒndS(iÿÿÿÿN(t run_unittesttfindfilet TestWithAsciicBseZd„Zd„ZRS(c CsÍtjddddddƒ}|j|jƒdddƒ|jt|jƒƒddgƒtjddddd ddd ƒ}|j|jƒdddƒ|jt|jƒƒdddgƒdS(Ntbidtag×£p= ×ï?tplacesitinsertiitequaliei2i3(sinsertiiii(Riidiie(Rii2ii2(sinserti2i2i2i3(Ri2idi3ie(tdifflibtSequenceMatchertNonetassertAlmostEqualtratiot assertEqualtlistt get_opcodes(tselftsm((s-/usr/local/lib/python2.7/test/test_difflib.pyttest_one_insert s! )c Csvtjddddddddddƒ}|j|jƒdddƒ|jt|jƒƒdddgƒdS(NRi(tcRg+‡ÙÎï?RiRitdeletei)iQiP(sequalii(ii((Ri(i)i(i((sequali)iQi(iP(RR R R R R RR(RR((s-/usr/local/lib/python2.7/test/test_difflib.pyttest_one_deletes 1(t__name__t __module__RR(((s-/usr/local/lib/python2.7/test/test_difflib.pyRs t TestAutojunkcBseZdZd„ZRS(s-Tests for the autojunk parameter added in 2.7cCs„dd}ddd}tjd||ƒ}|j|jƒdddƒtjd||dtƒ}|j|jƒdddƒdS( NRiÈRiRitautojunkgìQ¸…ëï?(RR R R R tFalse(Rtseq1tseq2R((s-/usr/local/lib/python2.7/test/test_difflib.pyt#test_one_insert_homogenous_sequence!s  (RRt__doc__R(((s-/usr/local/lib/python2.7/test/test_difflib.pyRst TestSFbugscBs,eZd„Zd„Zd„Zd„ZRS(cCs[tjdggƒ}|j|jƒdƒ|j|jƒdƒ|j|jƒdƒdS(Ni(RR R R R t quick_ratiotreal_quick_ratio(Rts((s-/usr/local/lib/python2.7/test/test_difflib.pyttest_ratio_for_null_seqn0scCsWtjdggƒjƒ}|jt|jƒtjggƒ}|jt|jƒdS(N(RR R tget_grouped_opcodest assertRaisest StopIterationtnextt unified_diff(Rt group_gentdiff_gen((s-/usr/local/lib/python2.7/test/test_difflib.pyttest_comparing_empty_lists7scCsvtjdddƒ}|jƒ}|jƒ}|j|djdƒ|j|djdƒ|j|djdƒdS(Ntabxcdtabcdiii(RR R tget_matching_blocksR tsize(RR"tfirsttsecond((s-/usr/local/lib/python2.7/test/test_difflib.pyttest_matching_blocks_cache>s   cCsxttjƒjdgdgƒƒ}|jd|dƒ|jd|dƒ|jd|dƒ|jd |d ƒdS( Ns I am a buggys I am a bugs- I am a buggyis? -- is+ I am a bugis? + i(RRtDiffertcompareR (Rtdiff((s-/usr/local/lib/python2.7/test/test_difflib.pyttest_added_tab_hintGs $(RRR#R+R2R6(((s-/usr/local/lib/python2.7/test/test_difflib.pyR/s   s 1. Beautiful is beTTer than ugly. 2. Explicit is better than implicit. 3. Simple is better than complex. 4. Complex is better than complicated. s™ 1. Beautiful is better than ugly. 3. Simple is better than complex. 4. Complicated is better than complex. 5. Flat is better than nested. sÞ Line 1: preceeded by from:[tt] to:[ssss] Line 2: preceeded by from:[sstt] to:[sssst] Line 3: preceeded by from:[sstst] to:[ssssss] Line 4: has from:[sst] to:[sss] after : Line 5: has from:[t] to:[ss] at end sá Line 1: preceeded by from:[tt] to:[ssss] Line 2: preceeded by from:[sstt] to:[sssst] Line 3: preceeded by from:[sstst] to:[ssssss] Line 4: has from:[sst] to:[sss] after : Line 5: has from:[t] to:[ss] at end sô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 endsù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 endt TestSFpatchescBseZd„Zd„ZRS(cCsÎtddd}tddd}dd|}dd|}|jƒ}|jƒ}|jƒ}|jƒ}tjƒ}tjƒ}t}t}tjƒ} tjddƒ} tjddƒ} | j ||d d d t d d ƒ} dj d| j ||d d d t ƒd| j ||d d d t ƒd| j ||d d d t d dƒd| j ||d d d t d dƒd| j ||d d d t ƒd| j ||d d d t ƒd| j ggd d d t ƒd| j ggd d d t ƒd| j ||ƒd| j ||ƒd| j |jƒ|jƒd t d dƒd| j |jƒ|jƒƒd| j |jt ƒ|jt ƒƒgƒ} | jdd| ƒ}ttd ƒƒ}|j||jƒƒWdQXdS(!Ns123 i is456 ttabsizeit wrapcolumnitfromttotcontexttnumlinesis s8

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

s7

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

s

Context (numlines=6)

is

Context (numlines=0)

is

Same Context

s

Same Full

s

Empty Context

s

Empty Full

s

tabsize=2

s

tabsize=default

s+

Context (wrapcolumn=14,numlines=0)

s#

wrapcolumn=14,splitlines()

s'

wrapcolumn=14,splitlines(True)

ss %s stest_difflib_expect.html(tpatch914575_from1tpatch914575_to1t splitlinestpatch914575_from2tpatch914575_to2tpatch914575_from3tpatch914575_to3RtHtmlDifft make_fileRtjoint make_tabletTruetreplacetopenRR tread(Rtf1att1atf1btt1btf2tt2tf3tt3titjtktfullttablestactualtfp((s-/usr/local/lib/python2.7/test/test_difflib.pyttest_html_diff‘s\       $!!'*cCs—tjƒ}gt|dƒD] }|dr3dp6d|^q}gt|dƒD] }|drjdpmd|^qT}tjd||ƒjƒdS(NisK:%dsV:A:%dsV:B:%d(tsystgetrecursionlimittrangeRR R R(RtlimitRUtoldtnew((s-/usr/local/lib/python2.7/test/test_difflib.pyttest_recursion_limitÊs 77(RRR\Rc(((s-/usr/local/lib/python2.7/test/test_difflib.pyR7s 9tTestOutputFormatcBs,eZd„Zd„Zd„Zd„ZRS(cCsŒddddddg}tjdd|Œ}|jt|ƒd d !d d gƒtjdd|Œ}|jt|ƒd d !d dgƒdS(NtonettwotOriginaltCurrents2005-01-26 23:30:50s2010-04-02 10:20:52tlinetermtiis --- Original 2005-01-26 23:30:50s+++ Current 2010-04-02 10:20:52s *** Original 2005-01-26 23:30:50s--- Current 2010-04-02 10:20:52(RR(R Rt context_diff(Rtargstudtcd((s-/usr/local/lib/python2.7/test/test_difflib.pyttest_tab_delimiterÓs   cCs†ddddg}tjdd|Œ}|jt|ƒdd!d d gƒtjdd|Œ}|jt|ƒdd!d d gƒdS( NReRfRgRhRiRjiis --- Originals +++ Currents *** Originals --- Current(RR(R RRk(RRlRmRn((s-/usr/local/lib/python2.7/test/test_difflib.pyt&test_no_trailing_tab_on_empty_filedateßs #cCsd}tj}|j|ddƒdƒ|j|ddƒdƒ|j|ddƒdƒ|j|ddƒd ƒ|j|d d ƒd ƒdS( Ns’ 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. is3,0it4is4,2is4,3is0,0(Rt_format_range_unifiedR (Rtspectfmt((s-/usr/local/lib/python2.7/test/test_difflib.pyttest_range_format_unifiedçs  cCsd}tj}|j|ddƒdƒ|j|ddƒdƒ|j|ddƒdƒ|j|ddƒd ƒ|j|d d ƒd ƒdS( Ns 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 ---- ", it3iRqis4,5is4,6it0(Rt_format_range_contextR (RRsRt((s-/usr/local/lib/python2.7/test/test_difflib.pyttest_range_format_contextøs (RRRoRpRuRy(((s-/usr/local/lib/python2.7/test/test_difflib.pyRdÒs  cCs8dtj_tjtƒ}ttttt t |ƒdS(Ni( RREt_default_prefixtdoctestt DocTestSuiteRRRR7RRd(tDoctests((s-/usr/local/lib/python2.7/test/test_difflib.pyt test_mains   t__main__(Rttest.test_supportRRtunittestR{R]tTestCaseRRRR>R?RARBRCRDR7RdR~R(((s-/usr/local/lib/python2.7/test/test_difflib.pyts$    %C?