Current File : //usr/local/apps/python3/lib/python3.11/test/__pycache__/test_complex.cpython-311.opt-1.pyc |
�
�Ke�� � �� � d dl Z d dlZd dlmZ d dlmZmZ d dlmZ d dlm Z m
Z
mZ d dlZ e
d� � Z e
d� � ZdZ G d � d
e j � � Zedk r e j � � dS dS )� N)�support)�VALID_UNDERSCORE_LITERALS�INVALID_UNDERSCORE_LITERALS)�random)�atan2�isnan�copysign�inf�nan))� �? �?� )r � )r r )� �?r
)� r
c �z � e Zd Zd� Zd%d�Zd� Zd%d�Zd� Zd� Zd� Z d � Z
d
� Zd� Zd� Z
d
� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zd� Zej d� � � Zd� Zd� Zd� Zd� Zej d� � � Zd� Z d� Z!ej d� � � Z"ej d � � � Z#ej d!� � � Z$ej d"� � � Z%d#� Z&d$S )&�ComplexTestc � � t |t � � r�t |t � � rXt j � | |j |j � � t j � | |j |j � � d S t j � | |j |� � t j � | |j d� � d S t |t � � rNt j � | ||j � � t j � | d|j � � d S t j � | ||� � d S )Nr )�
isinstance�complex�unittest�TestCase�assertAlmostEqual�real�imag��self�a�bs �;/usr/local/apps/python3/lib/python3.11/test/test_complex.pyr zComplexTest.assertAlmostEqual s � ��a��!�!� @��!�W�%�%�
F��!�3�3�D�!�&�!�&�I�I�I��!�3�3�D�!�&�!�&�I�I�I�I�I��!�3�3�D�!�&�!�D�D�D��!�3�3�D�!�&�"�E�E�E�E�E��!�W�%�%�
@��!�3�3�D�!�Q�V�D�D�D��!�3�3�D�"�a�f�E�E�E�E�E��!�3�3�D�!�Q�?�?�?�?�?� ��&�.>c �
� t |� � t |� � k r||}}|dk rt |� � |k S |dk rt |� � |k S | � t ||z
|z � � |k � � dS )z+Return true iff floats x and y "are close".r N)�abs�
assertTrue�r �x�y�epss r �assertCloseAbszComplexTest.assertCloseAbs( s � � �q�6�6�C��F�F�?�?��a�q�A���6�6��q�6�6�C�<����6�6��q�6�6�C�<������Q�q�S�!�G���s�*�+�+�+�+�+r c �H � d}t |� � st |� � r!t |� � rt |� � rdS n7||k r1|dk rdS t d|� � t d|� � k rdS |dz
}| � |� ||� � � � dS )a# assert that floats x and y are identical, in the sense that:
(1) both x and y are nans, or
(2) both x and y are infinities, with the same sign, or
(3) both x and y are zeros, with the same sign, or
(4) x and y are both finite and nonzero, and x == y
z&floats {!r} and {!r} are not identicalNr r z: zeros have different signs)r r �fail�format)r r&