File: //lib/python3/dist-packages/samba/tests/dcerpc/__pycache__/testrpc.cpython-310.pyc
o
�/a� � @ s� d dl Z e j�d d� d dlZd dlZd dlmZ d dlZe�� G dd� de �Z
e
� Ze�� Z
e
d kr;e �d � dS ede
� e �d� dS )� Nz
bin/python)�drsuapic @ s8 e Zd ZdZdd� Zdd� Zdd� Zdd � Zd
d� ZdS )
�RpcTestsz5test type behaviour of pidl generated python RPC codec C s@ t �|�}|du r|| j8 }|| }|dkrtd| � dS dS )z4check that the number of allocated blocks is correctNr zLeaked %d blocks)�talloc�total_blocks�initial_blocks�print)�self�object�num_expected�nblocks�
leaked_blocks� r
�</usr/lib/python3/dist-packages/samba/tests/dcerpc/testrpc.py�check_blocks s
�zRpcTests.check_blocksc C s6 t d| � |� }t|�D �]
}|d dkrq
zt||�}W n| ty� } zYt|�dkrAt d||f � | jd7 _W Y d }~q
t t|�dd� � t|�dd� dkrjt d ||f � | jd7 _W Y d }~q
t d
||f � | jd7 _W Y d }~q
d }~w ty� t d
||f � | jd7 _Y q
w zt d||f � t|||� W n6 ty� } z*t|t �r�t|��
d�r�W Y d }~q
t d
|||j|f � | jd7 _W Y d }~q
d }~ww z|t||�kr�t d|||t||�f � W q
W q
t�y } zt d|||j|f � W Y d }~q
d }~ww d S )NzChecking type %sr �_zunknown union levelz#ERROR: Unknown union level in %s.%s� � zCan not convert C TypezERROR: Unknown C type for %s.%sz"ERROR: Failed to instantiate %s.%sz
Setting %s.%szis read-onlyz"ERROR: Failed to set %s.%s: %r: %sz,ERROR: Comparison failed for %s.%s: %r != %rz*ERROR: compare exception for %s.%s: %r: %s)r �dir�getattr� TypeError�str�errcount� Exception�setattr�
isinstance�AttributeError�endswith� __class__) r � interface�typename�type�v�n�value�errstr�er
r
r �
check_type) s` ����
����zRpcTests.check_typec C s | j }t|�D ]i}|d dks||krqt||�}t|t�rqt|t�r%qt|t�rczt�d �}| � |||� | �
d |� W q tyb } ztd|||j
|f � | j d7 _ W Y d }~qd }~ww t|�rhqtd||f � q| j | dkr�td| j | |f � d S d S )Nr r z)ERROR: Failed to check_type %s.%s: %r: %sr zUNKNOWN: %s=%szFound %d errors in %s)r r r r r �intr r r r&