|
Server : LiteSpeed System : Linux server51.dnsbootclub.com 4.18.0-553.62.1.lve.el8.x86_64 #1 SMP Mon Jul 21 17:50:35 UTC 2025 x86_64 User : nandedex ( 1060) PHP Version : 8.1.33 Disable Function : NONE Directory : /opt/cppython/lib/python3.8/test/__pycache__/ |
U
>��g� � @ s� d Z ddlZddlZddlZddlZddlZddlmZ ejdkrLe� d��ddl
mZ ejZ
G dd� dej�Zed kr�e�� dS )
zTests for WindowsConsoleIO
� N)�support�win32ztest only relevant on win32)�write_inputc @ s� e Zd Zdd� Zdd� Zdd� Ze�e� � dd� d kd
�dd� �Z
d
d� Zdd� Zdd� Z
dd� Zdd� Zdd� Zdd� ZdS )�WindowsConsoleIOTestsc C s: | � tttj�� | �tttj�� | �tttj�� d S )N)�
assertTrue�
issubclass�ConIO�io� RawIOBase�assertFalse�BufferedIOBase�
TextIOBase��self� r �5/opt/cppython/lib/python3.8/test/test_winconsoleio.py�test_abc s zWindowsConsoleIOTests.test_abcc C s` | � tdtd� t�� �}|�� }| � tdt|� W 5 Q R X ztd�}W n tk
r\ Y n>X | �|�� � | �|� � � | �
d|�� � |�� |�� ztdd�}W n tk
r� Y n>X | �|�� � | �|� � � | �
d|�� � |�� |�� ztdd�}W n tk
�r Y n>X | �|�� � | �|� � � | �
d|�� � |�� |�� d S )Nznegative file descriptor���z&Cannot open (console|non-console file)r � �w� )ZassertRaisesRegex�
ValueErrorr �tempfile�
TemporaryFile�filenor �readabler �writable�assertEqual�close)r Ztmpfile�fd�fr r r �test_open_fd sN �
�z"WindowsConsoleIOTests.test_open_fdc C s� | � tttj� td�}| �|�� � | �|�� � | � |�
� � |�� |�� td�}| �|�� � | �|�� � | � |�
� � |�� |�� tdd�}| �|�� � | �|�� � | � |�
� � |�� |�� tdddd�}| �
|t� |�� d S ) NZCON�CONIN$�CONOUT$r zC:/con�rbr �� buffering)ZassertRaisesr r �sys�
executabler r r r ZassertIsNotNoner r �open�assertIsInstance�r r r r r �test_open_nameG s,
z$WindowsConsoleIOTests.test_open_nameNr �� r z+test does not work on Windows 7 and earlierc C sH t dddd�}| �|t� |�� t dddd�}| �|t� |�� d S )Nz
\\.\conin$r$ r r% z//?/conout$�wb)r) r* r r r+ r r r �test_conin_conout_namesc s z-WindowsConsoleIOTests.test_conin_conout_namesc C sp t �� }| �tj|� tj�|d�}t|ddd��4}t �
� d d� dkrV| �|t� n| �
|t� W 5 Q R X d S )Nr# r/ r r% r r- )r �mkdtempZ
addCleanupr �rmtree�os�path�joinr) r'