HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: //usr/local/lib/python3.10/dist-packages/numpy/f2py/tests/__pycache__/test_string.cpython-310.pyc
o

���g��@sfddlZddlZddlZddlZddlmZGdd�dej�ZGdd�dej�Z	Gdd	�d	ej�Z
dS)
�N�)�utilc@s.eZdZe�dddd�gZejjdd��Z	dS)�
TestString�tests�src�stringzchar.f90cCsntjgd�dd�j}|jj�||jd�\}}|t�|�ks J�|�	�}d|ddd�f<|t�|�ks5J�dS)N)�ab�cd�ef�c)�dtyper�AAA)
�np�array�T�module�	char_test�change_strings�shape�pytest�approx�copy)�self�strings�inp�out�expected�r�G/usr/local/lib/python3.10/dist-packages/numpy/f2py/tests/test_string.py�	test_chars
�zTestString.test_charN)
�__name__�
__module__�__qualname__r�getpath�sourcesr�mark�slowrrrrrrsrc@s&eZdZe�dddd�gZdd�ZdS)�TestDocStringArgumentsrrrzstring.fcCs~t�d�}t�d�}t�d�}t�d�}|j�||||�|��dks%J�|��dks-J�|��dks5J�|��dks=J�dS)Ns123s123sB23sD23)rrr�foo�tobytes)r�a�br�drrr�test_examples



z#TestDocStringArguments.test_exampleN)r r!r"rr#r$r-rrrrr'sr'c@sFeZdZe�dddd�gZeddd��Zdd
d�Zdd
�Z	dd�Z
dS)�TestFixedStringrrrzfixed_string.f90rNcCs|t|tj�r|��}n	t|t�r|��}t|t�sJ�|dur#t|�}d}t|t	|t|���D]}|||d|7}q/|S)z�Return the content of a string buffer as integer value.

        For example:
          _sint('1234') -> 4321
          _sint('123A') -> 17321
        Nr�
)
�
isinstancer�ndarrayr)�str�encode�bytes�len�range�min)�s�start�end�i�jrrr�_sint*s

zTestFixedString._sint�inccs��|dvr&dVdVdVdVdVdVdVd	Vd
VdVdVtjd
tjdd�Vt�d�Vt�d�Vt�d�Vt�d
�Vt�d	�Vt�d�Vt�d�Vt�d�VdS)N�r>��1�1234�12345���1�s1s1234s12345r)�buffers123)rr1�bytes_r)r�intentrrr�
_get_input>s,�zTestFixedString._get_inputcCs<|��D]}|j�|�}|j|dd�}||ksJ|��qdS)N��r:)rKr�test_in_bytes4r=)rr8�rrrrr�test_intent_inUs
�zTestFixedString.test_intent_incCs`|jdd�D]'}|j|dd�}|j�|�}|j|dd�}||ks"J�||j|dd�ks-J�qdS)N�inout)rJrL)r9rM)rKr=r�test_inout_bytes4)rr8�restrOrrrr�test_intent_inout\s�z!TestFixedString.test_intent_inout)rNr?)r r!r"rr#r$�staticmethodr=rKrPrTrrrrr.'s
r.)�osr�textwrap�numpyrr@r�F2PyTestrr'r.rrrr�<module>s