관리-도구
편집 파일: test_argparse.cpython-311.pyc
� �܋f� � �D � d Z ddlZddlZddlmZ d� Zd� Zd� Z d� Z d� ZdS ) a� Tests for the private NumPy argument parsing functionality. They mainly exists to ensure good test coverage without having to try the weirder cases on actual numpy functions but test them in one place. The test function is defined in C to be equivalent to (errors may not always match exactly, and could be adjusted): def func(arg1, /, arg2, *, arg3): i = integer(arg1) # reproducing the 'i' parsing in Python. return None � N)�argparse_example_functionc � � t j t d�� � 5 t d� � d d d � � n# 1 swxY w Y t j t � � 5 t ddz � � d d d � � d S # 1 swxY w Y d S )Nz$integer argument expected, got float��matchg �?� �d )�pytest�raises� TypeError�func� OverflowError� � �q/builddir/build/BUILD/cloudlinux-venv-1.0.6/venv/lib64/python3.11/site-packages/numpy/core/tests/test_argparse.py�test_invalid_integersr s � � ��y�8� :� :� :� � ��R����� � � � � � � � � � ���� � � � � ��}� %� %� � ��Q��V����� � � � � � � � � � � ���� � � � � � s �8�<�<�A<�<B �B c � � t j t d�� � 5 t � � d d d � � n# 1 swxY w Y t j t d�� � 5 t dd�� � d d d � � n# 1 swxY w Y t j t d�� � 5 t dd�� � d d d � � d S # 1 swxY w Y d S ) Nz&missing required positional argument 0r � � )�arg2�arg3z,missing required argument \'arg2\' \(pos 1\)� )r �r r r r r r r �test_missing_argumentsr s� � � ��y�:� <� <� <� � ������ � � � � � � � � � ���� � � � � ��y�:� <� <� <� � ��!�!������ � � � � � � � � � ���� � � � � ��y�A� C� C� C� � ��Q�Q������ � � � � � � � � � � ���� � � � � � s0 �7�;�;�A;�;A?�A?�!C � C�Cc � � t j t d�� � 5 t dddd� � d d d � � d S # 1 swxY w Y d S )Nz7takes from 2 to 3 positional arguments but 4 were givenr r r � r r r r r �test_too_many_positionalr ( s� � � ��y�K� M� M� M� � ��Q��1�a����� � � � � � � � � � � ���� � � � � � � �<�A �A c � � t j t d�� � 5 t ddd�� � d d d � � d S # 1 swxY w Y d S )Nz4given by name \('arg2'\) and position \(position 1\)r r r r )r r r r r �test_multiple_valuesr / s� � � ��y�I� K� K� K� � ��Q�������� � � � � � � � � � � ���� � � � � � r c � � t j d� � } t j d� � }t di | di�� t j t d�� � 5 t d i |di�� d d d � � d S # 1 swxY w Y d S ) Nr �missing_argr r z0got an unexpected keyword argument 'missing_arg'r r )r )r )�np�str_r r r r )r r! s r �test_string_fallbacksr$ 5 s� � � �7�6�?�?�D��'�-�(�(�K����t�Q�i���� ��y�D� F� F� F� $� $��#�#�;��"�#�#�#�$� $� $� $� $� $� $� $� $� $� $� $���� $� $� $� $� $� $s �A.�.A2�5A2)�__doc__r �numpyr"