
    <e                        d dl Z d dlZd dlZd dlZd dlZd dlmZ d dlm	Z	  e
ej        d          s ej        d          ddz  Zdd	d
dez  gZd                    e          dz   Zd                    e          dz   Zd                    e          dz   Zd                    e          dz   Zd eD             Z G d d          Z G d d          Z G d d          Z G d de          Z G d deeej                  Z G d deeej                  Z G d de          Z G d deeej                  Z G d  d!eeej                  Z G d" d#e          Z G d$ d%eeej                  Z  G d& d'eeej                  Z! G d( d)e          Z" G d* d+ee"ej                  Z# G d, d-ee"ej                  Z$e%d.k    r ej&                     dS dS )/    N)support)	os_helpernewlinesz3This Python does not have universal newline supportxi @  zline1=1zline2='this is a very long line designed to go past any default buffer limits that exist in io.py but we also want to test the uncommon case, naturally.'zdef line3():passzline4 = '%s'

c                     g | ]}|d z   S )r    ).0r   s     -/usr/lib/python3.11/test/test_univnewlines.py
<listcomp>r   !   s    ...1a$h...    c                       e Zd Zej        ZdS )CTestN)__name__
__module____qualname__ioopenr   r   r   r   r   #   s        7DDDr   r   c                   .    e Zd Z eej                  ZdS )PyTestN)r   r   r   staticmethodpyior   r   r   r   r   r   &   s        <	""DDDr   r   c                   :    e Zd ZdZdZd Zd Zd Zd Zd Z	d Z
d	S )
TestGenericUnivNewlinesrwbc                     | j         }d| j        v r|                    d          }|                     t          j        | j                  5 }|                    |           d d d            d S # 1 swxY w Y   d S )Nbascii)DATA	WRITEMODEencoder   r   TESTFNwrite)selfdatafps      r   setUpzTestGenericUnivNewlines.setUp/   s    y$.  ;;w''DYYy'88 	BHHTNNN	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	s   A..A25A2c                 T    	 t          j        t          j                   d S #  Y d S xY wN)osunlinkr   r%   )r'   s    r   tearDownz TestGenericUnivNewlines.tearDown6   s0    	Ii&'''''	DDs   " 'c                 R   |                      t          j        | j                  5 }|                                }d d d            n# 1 swxY w Y   |                     |t                     |                     t          |j                  t          | j	                             d S r,   )
r   r   r%   READMODEreadassertEqualDATA_LFreprr   NEWLINEr'   r)   r(   s      r   	test_readz!TestGenericUnivNewlines.test_read<   s    YYy'77 	27799D	 	 	 	 	 	 	 	 	 	 	 	 	 	 	w'''bk**D,>,>?????   AAAc                 R   |                      t          j        | j                  5 }|                                }d d d            n# 1 swxY w Y   |                     |t                     |                     t          |j                  t          | j	                             d S r,   )
r   r   r%   r1   	readlinesr3   
DATA_SPLITr5   r   r6   r7   s      r   test_readlinesz&TestGenericUnivNewlines.test_readlinesB   s    YYy'77 	"2<<>>D	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	"z***bk**D,>,>?????r9   c                    |                      t          j        | j                  5 }g }|                                }|r+|                    |           |                                }|+d d d            n# 1 swxY w Y   |                     |t                     |                     t          |j	                  t          | j
                             d S r,   )r   r   r%   r1   readlineappendr3   r<   r5   r   r6   )r'   r)   r(   ds       r   test_readlinez%TestGenericUnivNewlines.test_readlineH   s    YYy'77 	"2DA "AKKMM  "	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	z***bk**D,>,>?????s   AA66A:=A:c                    |                      t          j        | j                  5 }|                                 |                                }|                                }|                     |t          dd                     |	                    |           |                                }d d d            n# 1 swxY w Y   |                     |t          dd                     d S )N   )
r   r   r%   r1   r?   tellr;   r3   r<   seek)r'   r)   posr(   s       r   	test_seekz!TestGenericUnivNewlines.test_seekR   s    YYy'77 	"2KKMMM''))C<<>>DT:abb>222GGCLLL<<>>D	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	" 	z!""~.....s   B	B;;B?B?N)r   r   r   r1   r#   r*   r/   r8   r=   rB   rH   r   r   r   r   r   )   s         HI    @ @ @@ @ @@ @ @/ / / / /r   r   c                       e Zd ZdZeZdS )TestCRNewlinesr   N)r   r   r   r6   DATA_CRr"   r   r   r   rJ   rJ   ]           GDDDr   rJ   c                       e Zd ZdS )CTestCRNewlinesNr   r   r   r   r   r   rN   rN   `             r   rN   c                       e Zd ZdS )PyTestCRNewlinesNrO   r   r   r   rR   rR   a   rP   r   rR   c                       e Zd ZdZeZdS )TestLFNewlinesr   N)r   r   r   r6   r4   r"   r   r   r   rT   rT   c   rL   r   rT   c                       e Zd ZdS )CTestLFNewlinesNrO   r   r   r   rV   rV   f   rP   r   rV   c                       e Zd ZdS )PyTestLFNewlinesNrO   r   r   r   rX   rX   g   rP   r   rX   c                       e Zd ZdZeZd ZdS )TestCRLFNewlinesr	   c                    |                      t          j        | j                  5 }|                     t          |j                  t          d                      |                                }|                                }d d d            n# 1 swxY w Y   |                     t          |j                  t          | j	                             d S r,   )
r   r   r%   r1   r3   r5   r   r?   rE   r6   )r'   r)   r(   rG   s       r   	test_tellzTestCRLFNewlines.test_tellm   s    YYy'77 	2T"+..T

;;;;;==D''))C	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	bk**D,>,>?????s   ABBBN)r   r   r   r6   	DATA_CRLFr"   r\   r   r   r   rZ   rZ   i   s2        GD@ @ @ @ @r   rZ   c                       e Zd ZdS )CTestCRLFNewlinesNrO   r   r   r   r_   r_   s   rP   r   r_   c                       e Zd ZdS )PyTestCRLFNewlinesNrO   r   r   r   ra   ra   t   rP   r   ra   c                       e Zd ZdZeZdS )TestMixedNewlines)r   r   N)r   r   r   r6   
DATA_MIXEDr"   r   r   r   rc   rc   v   s        GDDDr   rc   c                       e Zd ZdS )CTestMixedNewlinesNrO   r   r   r   rf   rf   y   rP   r   rf   c                       e Zd ZdS )PyTestMixedNewlinesNrO   r   r   r   rh   rh   z   rP   r   rh   __main__)'r   _pyior   unittestr-   systestr   test.supportr   hasattrstdinSkipTestFATXDATA_TEMPLATEjoinr4   rK   r]   rd   r<   r   r   r   rJ   TestCaserN   rR   rT   rV   rX   rZ   r_   ra   rc   rf   rh   r   mainr   r   r   <module>rw      s   				      				 



       " " " " " " wsy*%% ?
(
=? ? ? e} ) T ))M
"
"T
)
))M
"
"T
)KK&&/	 YY}%%,
.....
       # # # # # # # #1/ 1/ 1/ 1/ 1/ 1/ 1/ 1/h    ,    F E E E Ee^X-> E E E G G G G Gv~x/@ G G G    ,    F E E E Ee^X-> E E E G G G G Gv~x/@ G G G	@ 	@ 	@ 	@ 	@. 	@ 	@ 	@ J I I I I/1B I I I K K K K K!183D K K K    /    L K K K K 183D K K K M M M M M&"3X5F M M MzHMOOOOO r   