a
    mzf}                     @   s   d Z ddlZddlmZmZmZmZ ejdeddfeddfeddffdd Z	ejd	eefd
d Z
dd Zejddeddffdd Zdd ZdS )z2Test suite for cross-python compatibility helpers.    N)extract_bytesntobntoubtonfuncinpoutbar   barc                 C   s   | |dd|ksJ dS )z;Check that compatibility functions work with correct input.utf-8encodingN r   r   r   G/var/www/media/lib/python3.9/site-packages/cheroot/test/test__compat.pytest_compat_functions_positive   s    
r   r   c                 C   s>   d}t t | |dd W d   n1 s00    Y  dS )zCCheck that compatibility functions fail loudly for incorrect input.r   r   r   N)pytestraises	TypeError)r   Znon_native_test_strr   r   r   (test_compat_functions_negative_nonnative   s    	r   c                  C   s    d} t ddd}|| ksJ dS )z<Check that ``ntou`` supports escape-encoding under Python 2.u
   hišřіїescaper   N)r   )expectedactualr   r   r   test_ntou_escape#   s    r   Zinput_argumentZexpected_result)   qwertyr   s   asdfghc                 C   s   t | |ksJ dS )z+Check that legitimate inputs produce bytes.N)r   r   r   r   r   test_extract_bytes*   s    	r   c                   C   s:   t jtdd td W d   n1 s,0    Y  dS )z8Ensure that invalid input causes exception to be raised.z<^extract_bytes\(\) only accepts bytes and memoryview/buffer$)matchu   some юнікод їїїN)r   r   
ValueErrorr   r   r   r   r   test_extract_bytes_invalid6   s
    r   )__doc__r   Zcheroot._compatr   r   r   r   markZparametrizer   r   r   
memoryviewr   r   r   r   r   r   <module>   s4   



