Uname: Linux web3.us.cloudlogin.co 5.10.226-xeon-hst #2 SMP Fri Sep 13 12:28:44 UTC 2024 x86_64
Software: Apache
PHP version: 8.1.31 [ PHP INFO ] PHP os: Linux
Server Ip: 162.210.96.117
Your Ip: 3.145.115.172
User: edustar (269686) | Group: tty (888)
Safe Mode: OFF
Disable Function:
NONE

name : test_difflib.cpython-310.pyc
o

`b�U�@sddlZddlmZddlZddlZddlZGdd�dej�ZGdd�dej�ZGdd�dej�Z	d	Z
d
ZdZdZ
d
ZdZdZdZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�ZGdd�dej�Zdd�Zdd�Zedkr�e��dSdS) �N)�findfilec@�$eZdZdd�Zdd�Zdd�ZdS)�
TestWithAsciicCs�t�ddd�}|j|��ddd�|�t|���ddg�|�|jt��t�ddd�}|j|��ddd�|�t|���gd	��|�|jt��dS)
NZdbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbZeabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbgףp=
��?��Zplaces)�insertrrr�)�equalr�dr�eZebbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb))r	r�2rr)rrrr�3)r	rr
r
r)	�difflib�SequenceMatcher�assertAlmostEqual�ratio�assertEqual�list�get_opcodes�bpopular�set��self�sm�r�:/usr/local/python-3.10/lib/python3.10/test/test_difflib.py�test_one_insert	s���zTestWithAscii.test_one_insertcCs>t�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)NcS�|dkS�N� r��xrrr�<lambda>!�z*TestWithAscii.test_bjunk.<locals>.<lambda>rZTaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb)Zisjunk�a�bcSr$r%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-rrrrrsrc@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/r0�__doc__r2rrrrr1.sr1c@s<eZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)�
TestSFbugscCsBt�dgg�}|�|��d�|�|��d�|�|��d�dS)Nr)rrrrZquick_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)rr5�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=rBrCrrr�%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/r0r6r<rArErFrJrrrrr4@s	r4z�
   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@�4eZdZdd�Zdd�Zdd�Zdd�Zd	d
�ZdS)�
TestSFpatchesc!Cs�tdd}tdd}d|}d|}|��}|��}|��}|��}t��}t��}t}t}t��}	tjdd�}
tjdd�}|	j	||dd	d
dd�}d
�
d|	j||dd	dd�d|	j||dd	dd�d|	j||dd	ddd�d|	j||dd	ddd�d|	j||dd	dd�d|	j||dd	d
d�d|	jggdd	dd�d|	jggdd	d
d�d|
�||�d|	�||�d|j|��|��ddd�d|�|��|���d|�|�d�|�d��g�}
|�dd |
�}t
td!�d"d#��}|�||���Wd�dS1s�wYdS)$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<h2>Context (first diff within numlines=5(default))</h2>T)rRz7<h2>Context (first diff after numlines=5(default))</h2>z<h2>Context (numlines=6)</h2>�z<h2>Context (numlines=0)</h2>rz<h2>Same Context</h2>z<h2>Same Full</h2>z<h2>Empty Context</h2>z<h2>Empty Full</h2>z<h2>tabsize=2</h2>z<h2>tabsize=default</h2>z+<h2>Context (wrapcolumn=14,numlines=0)</h2>z#<h2>wrapcolumn=14,splitlines()</h2>z'<h2>wrapcolumn=14,splitlines(True)</h2>z</body>z
%s
</body>ztest_difflib_expect.htmlzutf-8)�encoding)�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�sb

��"�zTestSFpatches.test_html_diffcCsJt��}dd�t|d�D�}dd�t|d�D�}t�d||���dS)NcS� g|]}|dr
dpd|�qS)r=�K:%dzV:A:%dr��.0rerrr�
<listcomp>�� z6TestSFpatches.test_recursion_limit.<locals>.<listcomp>r=cSrl)r=rmzV:B:%drrnrrrrp�rq)�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"�rr]r^rVrXrW�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"ryr{rrr�test_make_file_iso88591_charsets
�z-TestSFpatches.test_make_file_iso88591_charsetcCs<t��}|jt��t��dd�}|�d|�|�d|�dS)Nzus-asciir~z%content="text/html; charset=us-ascii"z&#305;mpl&#305;c&#305;t)rr]r^�patch914575_nonascii_from1rX�patch914575_nonascii_to1rzr{rrr�2test_make_file_usascii_charset_with_nonascii_inputs
�z@TestSFpatches.test_make_file_usascii_charset_with_nonascii_inputN)r.r/r0rkrxr}r�r�rrrrrL�s9rLc@s,eZdZdd�Zdd�Zdd�Zdd�Zd	S)
�TestOutputFormatcC�dgd�}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_delimitercCr�)
N)r�r�r�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_filedatecC�hd}tj}|�|dd�d�|�|dd�d�|�|dd�d�|�|dd�d	�|�|d
d
�d�dS)Na�           Each <range> field shall be of the form:
             %1d", <beginning line number>  if the range contains exactly one line,
           and:
            "%1d,%1d", <beginning line number>, <number of lines> 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��4rQz4,2rTz4,3rz0,0)rZ_format_range_unifiedr�r�spec�fmtrrr�test_range_format_unified)sz*TestOutputFormat.test_range_format_unifiedcCr�)Na           The range of lines in file1 shall be written in the following format
           if the range contains two or more lines:
               "*** %d,%d ****
", <beginning line number>, <ending line number>
           and the following format otherwise:
               "*** %d ****
", <ending line number>
           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 ----
", <beginning line number>, <ending line number>
           and the following format otherwise:
               "--- %d ----
", <ending line number>
        rrHr�r�rQz4,5rTz4,6r�0)rZ_format_range_contextrr�rrr�test_range_format_context:sz*TestOutputFormat.test_range_format_contextN)r.r/r0r�r�r�r�rrrrr�s
r�c@sDeZdZdd�Zdd�Zdd�Zdd�Zd	d
�Zdd�Zd
d�Z	dS)�	TestBytescCs(t|�}|D]}|�|td|�qdS)Nz.all lines of diff should be bytes, but got: %r)rZassertIsInstance�bytes)rrD�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,�unifiedrRr�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]
\}}��||�qdSr7)rr�len�zip)�expectri�er+rIrr�
assertDiff�s
�z1TestBytes.test_byte_filenames.<locals>.assertDiff)s--- �odz.txts
+++ łodz.txt�@@ -1 +1 @@�-�odz is a city in Poland.�+Łodz is a city in Poland.�)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�rRr�r�ri�datea�datebrrIr�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�rRr�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_filenamescCsZdg}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�n1swY|�|t|j��dSr7)r8�	TypeErrorrr�str�	exception)r�msg�	generatorr��ctxrrrr��s�zTestBytes._assert_type_errorN)
r.r/r0r�r�r�r�r�r�r�rrrrr�Ss5r�c@rK)�TestJunkAPIscC�$dD]
}|�t�|�t|��qdS)N)�#z  z #z# z # r�)�
assertTruer�IS_LINE_JUNK�repr�rr�rrr�test_is_line_junk_true���z#TestJunkAPIs.test_is_line_junk_truecCr�)N)�##z ##z## zabc zabc #zMr. Moose is up!)�assertFalserr�r�r�rrr�test_is_line_junk_false�r�z$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_REDOScCr�)N)r&r�)r�r�IS_CHARACTER_JUNKr��r�charrrr�test_is_character_junk_true�r�z(TestJunkAPIs.test_is_character_junk_truecCr�)N)r+r�rS��
�)r�rr�r�r�rrr�test_is_character_junk_false�r�z)TestJunkAPIs.test_is_character_junk_falseN)r.r/r0r�r�r�r�r�rrrrr��sr�c@r)�TestFindLongestcs8t�fdd���fdd�tdt���d�D�D��S)Nc3s�|]}|�vVqdSr7r)roZb_part)r+rr�	<genexpr>�s�z6TestFindLongest.longer_match_exists.<locals>.<genexpr>cs g|]}�||�d��qS)rrrn)r,�nrrrp�rqz7TestFindLongest.longer_match_exists.<locals>.<listcomp>rr)�anyrtr�)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��|jddd
�}|�|jd�|�|jd�|�|jd�|�||j|j|j�||j|j|j��|�|�||dd�|j��dS)Nzfoo barzfoo baz bar�r+r,rrTr=r�)Zalo�blor�rQr)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�crQ)
rrr�r�rr+r,r>r�r�r�rrr�%test_longest_match_with_popular_charss�z5TestFindLongest.test_longest_match_with_popular_charsN)r.r/r0r�r�r�rrrrr��sr�cCsdtj_dS)Nr)rr]Z_default_prefixrrrr�setUpModule&sr�cCs|�t�t��|Sr7)ZaddTest�doctestZDocTestSuiter)�loaderZtests�patternrrr�
load_tests*sr��__main__)rZtest.supportrZunittestr�rrZTestCaserr1r4rVrWr�r�rYrZr[r\rLr�r�r�r�r�r�r.�mainrrrr�<module>s6&.X?.�
© 2025 GrazzMean