Sindbad~EG File Manager
�
'Μg�
� � � d dl Z d dlZd dlZd dlZd dlZd dlZd dlmZ ej d�� ej ej dd dk( d� G d� d ej � � Zd
� Z
edk( r ej � yy)� N)�supportT)�module� �winz can't easily test on this systemc � � e Zd Z G d� d� Z G d� d� Zd� Z ej ej j d� d� d� � Zd � Z e
j � d
� � Z ej e
j d� d� � Zd
� Zy)�SelectTestCasec � � e Zd Zy)�SelectTestCase.NopeN)�__name__�
__module__�__qualname__� � �-/usr/local/lib/python3.12/test/test_select.py�Noper
s � �r r c � � e Zd Zd� Zy)�SelectTestCase.Almostc � � y)N�filenor ��selfs r r zSelectTestCase.Almost.fileno s � �r N�r r r
r r r r �Almostr s � � r r c �� � | j t t j ddd� | j t t j | j � gg g � | j t t j | j � gg g � | j t t j g g g d� | j t
t j g g g d� y )N� � r znot a number���)�assertRaises� TypeError�selectr r �
ValueErrorr s r �test_error_conditionsz$SelectTestCase.test_error_conditions s� � ����)�V�]�]�A�q�!�<����)�V�]�]�T�Y�Y�[�M�2�r�J����)�V�]�]�T�[�[�]�O�R��L����)�V�]�]�B��B��O����*�f�m�m�R��R��Dr �freebsdz*skip because of a FreeBSD bug: kern/155606c �d � t t d� 5 }|j � }|j � t j |gg g d� | j d� d d d � y # t $ r4}| j |j t j � Y d }~�Ad }~ww xY w# 1 sw Y y xY w)N�rbr zexception not raised)
�open�__file__r �closer �fail�OSError�assertEqual�errno�EBADF)r �fp�fd�errs r �
test_errnozSelectTestCase.test_errno s� � � �(�D�
!�R�����B��H�H�J�
2��
�
�r�d�B��A�.� � � �0�1� "�
!��
�
9�� � ����E�K�K�8�8��
9�� "�
!�s4 �!B&�A&�B&�& B#�/*B�B&�B#�#B&�&B/c � � t j g g g d� \ }}}| j ||� | j ||� | j ||� y )Nr )r �assertIsNot)r �r�w�xs r �test_returned_list_identityz*SelectTestCase.test_returned_list_identity+ sL � ��-�-��B��A�.���1�a�����A������A������A�r c � � t j d� }t j dd|g}t j
|t j �� 5 }|j }dD ]� }t j rt d|� �� t j |gg g |� \ }}}| j |g � | j |g � |s�e||gk( rT|j � } t j rt t | � � | st j rt d� n��| j d|||� �� d d d � y # 1 sw Y y xY w) Nz�
import time
for i in range(10):
print("testing...", flush=True)
time.sleep(0.050)
z-Iz-c)�stdout)r r r � � � NNNNNNNNNNz
timeout = �EOFz'Unexpected return values from select():)�textwrap�dedent�sys�
executable�
subprocess�Popen�PIPEr9 r �verbose�printr r+ �readline�reprr) )
r �code�cmd�proc�pipe�timeout�rfd�wfd�xfd�lines
r �test_selectzSelectTestCase.test_select2 s
� ���� �
�� �~�~�t�T�4�0��
�
�
�c�*�/�/�
:�d��;�;�D�;���?�?��J�w�i�0�1� &�
�
�t�f�b�"�g� F�
��S�#�� � ��b�)�� � ��b�)����4�&�=��=�=�?�D�����d�4�j�)��"�?�?�!�%�L���� � �C��s�C�)�# <� ;�
:�
:�s
�C$D<�<Ez-Emscripten cannot select a fd multiple times.c � �� g � G �fd�d� } |� gdz �d d | j t j g �g � g �d d g f� y )Nc � �� e Zd Z� fd�Zy)�-SelectTestCase.test_select_mutated.<locals>.Fc �F �� �d= t j j � S )Nr )r@ �
__stdout__r )r �as �r r z4SelectTestCase.test_select_mutated.<locals>.F.filenoX s �� ��b�E��~�~�,�,�.�.r Nr )rX s �r �FrU W s �� �
/r rY �
� )r+ r )r rY rX s @r �test_select_mutatedz"SelectTestCase.test_select_mutatedR sP �� �
�� /� /� ��u�r�z��!��������r�1�b�1�B��"�1��r�?�Cr c �� � t j | t t j � � � t t d� r2t j | t t j � � � y y )N�devpoll)r �check_disallow_instantiation�typer �poll�hasattrr^ r s r �test_disallow_instantiationz*SelectTestCase.test_disallow_instantiation^ sH � ��,�,�T�4����
�3F�G��6�9�%��0�0��t�F�N�N�<L�7M�N� &r N)r r r
r r r"