HEX
Server: Apache
System: Linux scp1.abinfocom.com 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64
User: confeduphaar (1010)
PHP: 8.1.33
Disabled: exec,passthru,shell_exec,system
Upload Files
File: //lib/python3/dist-packages/hamcrest/library/number/__pycache__/iscloseto.cpython-38.pyc
U

�b�V��@sPddlZddlmZddlmZdZdZdZdd�ZGd	d
�d
e�Z	dd�Z
dS)
�N)�BaseMatcher)�fabszJon ReidzCopyright 2011 hamcrest.orgzBSD, see License.txtcCsZt|ttftj�rdSzt|�ddd}WdStk
rHYdSYdSXdS)zKConfirm that 'value' can be treated numerically; duck-test accordingly
    Tr�F)�
isinstance�float�complex�sixZ
integer_typesr�ArithmeticError)�value�_�r�C/usr/lib/python3/dist-packages/hamcrest/library/number/iscloseto.py�	isnumeric
srcs4eZdZdd�Zdd�Z�fdd�Zdd�Z�ZS)	�	IsCloseTocCs0t|�std��t|�s td��||_||_dS)NzIsCloseTo value must be numericzIsCloseTo delta must be numeric)r�	TypeErrorr
�delta)�selfr
rrrr
�__init__szIsCloseTo.__init__cCs t|�sdSt||j�|jkS)NF)rrr
r)r�itemrrr
�_matches%szIsCloseTo._matchescsDt|�stt|��||�n$t||j�}|�|��d��|�dS)Nz
 differed by )r�superr�describe_mismatchrr
�append_description_of�append_text)rrZmismatch_descriptionZactual_delta��	__class__rr
r*s
��zIsCloseTo.describe_mismatchcCs$|�d��|j��d��|j�dS)Nza numeric value within z of )rrrr
)rZdescriptionrrr
�describe_to3s
���zIsCloseTo.describe_to)�__name__�
__module__�__qualname__rrrr�
__classcell__rrrr
rs		rcCs
t||�S)a�Matches if object is a number close to a given value, within a given
    delta.

    :param value: The value to compare against as the expected value.
    :param delta: The maximum delta between the values for which the numbers
        are considered close.

    This matcher compares the evaluated object against ``value`` to see if the
    difference is within a positive ``delta``.

    Example::

        close_to(3.0, 0.25)

    )r)r
rrrr
�close_to:sr!)rZhamcrest.core.base_matcherrZmathr�
__author__Z
__copyright__Z__license__rrr!rrrr
�<module>s