| Server IP : 121.121.20.254 / Your IP : 216.73.216.202 Web Server : Microsoft-IIS/10.0 System : Windows NT WEB-SERVER 10.0 build 20348 (Windows Server 2022) AMD64 User : IUSR ( 0) PHP Version : 8.3.28 Disable Function : NONE MySQL : ON | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/Python315/Lib/test/__pycache__/ |
Upload File : |
R
>lqj� c �d � Q s ] PHs] PHs] PHs] PHs] PHs] PHs] PHs] PH s] PH$s ] PH(s
] PH,s] PH0s] QH4Gs ] QH<GsGs ] QHGs ] QHLGs ] PHTsQQts s\ \* Qx6H sQ sQ sQ sQyQ
ks Q Q2 s\O: Q
Q,Q5 s\O: Q
Q,Q5 s Q Q\O@ 2 s! Q Q\O@ 2 s" Q Q\O@ 2 s# Q Q\O@ 2 s$ Q Q\O@ 2 s% Q Q\O@ 2 s& Q Q\O@ 2 s' Q Q \O@ 2 s( Q! Q"\O@ 2 s) Q# Q$\O@ 2 s* Q% Q&\O@ 2 s+ Q' Q(\O@ 2 s, Q) Q*\O@ 2 s- Q+ Q,\O@ 2 s. Q- Q.\O@ 2 s/ Q/ Q0\O@ 2 s0 Q1 Q2\O@ 2 s1 Q3 Q4\O@ 2 s2 Q5 Q62 s3 Q7 Q82 s4 Q9 Q:\3\42 s5 Q; Q<\"2 s6 Q= Q>\"2 s7 Q? Q@\"2 s8 QA QB\32 s9 QC QD\"\9\42 s: QE QF\"\9\42 s; QG QH\"\92 s< QI QJ\"\42 s= QK QL\<\42 s> QM QN\<\42 s? QO QP\<2 s@ QQ QR\"\9\42 sA QS QT\O@ 2 sB QU QV\O@ 2 sC QW QX\32 sD QY QZ\D\"\42 sE Q[ Q\\D\"\42 sF Q] Q^\D\"2 sG Q_ Q`\O@ 2 sH Qa Qb\D\"2 sI Qc Qd\O@ 2 sJ Qe Qf\O@ 2 sK Qg Qh\O@ 2 sL Qi Qj\O@ 2 sM Qk Ql\O@ 2 sN Qm Qn\O@ 2 sO Qo Qp2 sP Qq Qr\O@ \P2 sQ\O� \Qs2 Qt Qu\O@ \P2 2 sSQv sT\UQw6X c \O� 2 P! P! )zz_Test suite for statistics module, including helper NumericTestCase and
approx_equal function.
)�support)�
import_helper�requires_IEEE_754)�Decimal��Fractiong ��7y�ACg�):��@c �2 � [ O ]U 2 ! )z:Return -1.0 for negatives, including -0.0, otherwise +1.0.)�math�copysign��xs &�)C:\Python315\\Lib\test\test_statistics.py�signr
% s � ��=�=��A��� c �J � [ U 2 [ U2 Ic P
! [ U [ 2 % c5 [ O U 2 9% c [ O U2 ! U O 2 ]* oUO 2 ]* oV#6H 9% c UQ7 ! )a� Return True if a and b are both the same kind of NAN.
>>> _nan_equal(Decimal('NAN'), Decimal('NAN'))
True
>>> _nan_equal(Decimal('sNAN'), Decimal('sNAN'))
True
>>> _nan_equal(Decimal('NAN'), Decimal('sNAN'))
False
>>> _nan_equal(Decimal(42), Decimal('NAN'))
False
>>> _nan_equal(float('NAN'), float('NAN'))
True
>>> _nan_equal(float('NAN'), 0.5)
False
>>> _nan_equal(float('NAN'), Decimal('NAN'))
False
NAN payloads are not compared.
)�n�N)�type�
isinstance�floatr �isnan�as_tuple)�a�b�aexp�bexps && r �
_nan_equalr ) su � �, �A�w�d�1�g����!�U����z�z�!�}�.�.����A��.��:�:�<��?�D��:�:�<��?�D��L�2�2�t�z�1�2r c � � [ [ U 2 [ U2 2 o[ V*
2 oU% c V2* L
[ Q2 oV41! )z�Return the absolute and relative errors between two numbers.
>>> _calc_errors(100, 75)
(25, 0.25)
>>> _calc_errors(100, 100)
(0, 0.0)
Returns the (absolute error, relative error) between the two arguments.
�inf)�max�absr )�actual�expected�base�abs_err�rel_errs && r �_calc_errorsr% H s= � � �s�6�{�C��M�*�D��&�#�$�G�"�g�l��e��G���r c
� � U] 6 f U] 6 c [ Q2 g[ O U 2 % f [ O U2 % c P
! V6X c P ! [ O U 2 % f [ O U2 % c P
! [ V*
2 o[ V#[ [ U 2 [ U2 2 * 2 oVE6* ! )aB approx_equal(x, y [, tol [, rel]]) => True|False
Return True if numbers x and y are approximately equal, to within some
margin of error, otherwise return False. Numbers which compare equal
will also compare approximately equal.
x is approximately equal to y if the difference between them is less than
an absolute error tol or a relative error rel, whichever is bigger.
If given, both tol and rel must be finite, non-negative numbers. If not
given, default values are tol=1e-12 and rel=1e-7.
>>> approx_equal(1.2589, 1.2587, tol=0.0003, rel=0)
True
>>> approx_equal(1.2589, 1.2587, tol=0.0001, rel=0)
False
Absolute error is defined as abs(x-y); if that is less than or equal to
tol, x and y are considered approximately equal.
Relative error is defined as abs((x-y)/x) or abs((x-y)/y), whichever is
smaller, provided x or y are not zero. If that figure is less than or
equal to rel, x and y are considered approximately equal.
Complex numbers are not directly supported. If you wish to compare to
complex numbers, extract their real and imaginary parts and compare them
individually.
NANs always compare unequal, even with themselves. Infinities compare
approximately equal if they have the same sign (both positive or both
negative). Infinities with different signs compare unequal; so do
comparisons of infinities with finite numbers.
z%error tolerances must be non-negative)�
ValueErrorr r �isinfr r )r �y�tol�rel�actual_error�
allowed_errors &&&& r �approx_equalr. X s� � �D �Q�w�#��'��@�A�A��z�z�!�}�}��
�
�1�
�
���v���z�z�!�}�}��
�
�1�
�
� ��q�u�:�L����S��V�S��V�!4�4�5�M��(�(r c � � \ sQ s]�sQsQsP! )�
_DoNothingaE
When doing numeric work, especially with floats, exact equality is often
not what you want. Due to round-off error, it is often a bad idea to try
to compare floats with equality. Instead the usual procedure is to test
them with some (hopefully small!) allowance for error.
The ``approx_equal`` function allows you to specify either an absolute
error tolerance, or a relative error, or both.
Absolute error tolerances are simple, but you need to know the magnitude
of the quantities being compared:
>>> approx_equal(12.345, 12.346, tol=1e-3)
True
>>> approx_equal(12.345e6, 12.346e6, tol=1e-3) # tol is too small.
False
Relative errors are more suitable when the values you are comparing can
vary in magnitude:
>>> approx_equal(12.345, 12.346, rel=1e-4)
True
>>> approx_equal(12.345e6, 12.346e6, rel=1e-4)
True
but a naive implementation of relative error testing can run into trouble
around zero.
If you supply both an absolute tolerance and a relative error, the
comparison succeeds if either individual test succeeds:
>>> approx_equal(12.345e6, 12.346e6, tol=1e-3, rel=1e-4)
True
� )�__name__�
__module__�__qualname__�__firstlineno__�__doc__�__static_attributes__r1 r r r0 r0 � s
� �"�F r r0 �
statistics�_statistics)�blocked)�freshc �` ` � \ sQ s]�s n Q,sQ s\O \Q2 Q 2 s Qs
U sP! )�TestModules�_normal_dist_inv_cdfc � � U O F D- oU O [ [ U2 O Q 2 J/ P! �r8 )�
func_names�assertEqual�getattr�
py_statisticsr3 ��self�fnames & r �test_py_functions�TestModules.test_py_functions� s- � ��_�_�E����W�]�E�:�E�E�|�T� %r �requires _statisticsc � � U O F D- oU O [ [ U2 O Q 2 J/ P! )r9 )rA rB rC �c_statisticsr3 rE s & r �test_c_functions�TestModules.test_c_functions� s- � ��_�_�E����W�\�5�9�D�D�m�T� %r r1 )r2 r3 r4 r5 rA rH �unittest�
skipUnlessrL rM r7 �__classdictcell__��
__classdict__s @r r= r= � s7 �� � �(�)�J�U� ����'=�>�U� ?�Ur r= c �X ` � \ sQ s]�s n Qs] 9ssQQ ksQ sQQ ks \
Q 2 sQsU s
P! ) �NumericTestCasez�Unit test class for numeric work.
This subclasses TestCase. In addition to the standard method
``TestCase.assertAlmostEqual``, ``assertApproxEqual`` is provided.
c �6 � Ue
U O oUe
U O o[ U[ O O
2 % c8 [ U[ O O
2 % c U O oLU O oU VV4U2 P! )a� Test passes if ``first`` and ``second`` are approximately equal.
This test passes if ``first`` and ``second`` are equal to
within ``tol``, an absolute error, or ``rel``, a relative error.
If either ``tol`` or ``rel`` are None or not given, they default to
test attributes of the same name (by default, 0).
The objects may be either numbers, or sequences of numbers. Sequences
are tested element-by-element.
>>> class MyTest(NumericTestCase):
... def test_number(self):
... x = 1.0/6
... y = sum([x]*6)
... self.assertApproxEqual(y, 1.0, tol=1e-15)
... def test_sequence(self):
... a = [1.001, 1.001e-10, 1.001e10]
... b = [1.0, 1e-10, 1e10]
... self.assertApproxEqual(a, b, rel=1e-3)
...
>>> import unittest
>>> from io import StringIO # Suppress test runner output.
>>> suite = unittest.TestLoader().loadTestsFromTestCase(MyTest)
>>> unittest.TextTestRunner(stream=StringIO()).run(suite)
<unittest.runner.TextTestResult run=2 errors=0 failures=0>
)r* r+ r �collections�abc�Sequence�_check_approx_seq�_check_approx_num)rF �first�secondr* r+ �msg�checks &&&&&& r �assertApproxEqual�!NumericTestCase.assertApproxEqual� sp � �>