
    [Ahd                        S SK r S SKr S SKrS SKrS SKrS SKrS SKrS SK	r	S SK
Jr  S SKJrJrJrJr  SSKJrJrJrJr  SSKJrJrJrJrJrJrJr  SSKJ r   SSK!J"r"  0 r#\RH                  S:  a  S	\#S
'   0 r%S\RL                  ;   a  S\%S'   OS\%S'    " S S\RN                  5      r( " S S\RN                  5      r)g! \ a    S SKr Nf = f)    N)givenassumesettingsexample   )CurveFpPointJacobiINFINITYPoint)generator_256	curve_256generator_224generator_brainpoolp160r1curve_brainpoolp160r1generator_112r2curve_112r2)inverse_mod)	randrange)      i  deadlinez--fastr   max_examples
   c                      \ rS rSrS rS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS rS r\ " SX0 \!D6\"" \#RH                  " S\%" \&RN                  " 5       S-
  5      S 95      S! 5       5       r(\ " SX0 \!D6\"" \#RH                  " S\%" \&RN                  " 5       S-
  5      S 95      \)" S5      \)" \%" \&RN                  " 5       5      5      S" 5       5       5       5       r*\ " SX0 \!D6\"" \#RH                  " S\%" \&RN                  " 5       S-
  5      S 9\#RH                  " S\%" \&RN                  " 5       S-
  5      S 95      \)" S#S#5      S$ 5       5       5       r+\ " SX0 \!D6\"" \#RH                  " S\%" \&RN                  " 5       S-
  5      S 9\#RH                  " S\%" \&RN                  " 5       S-
  5      S 9\#RH                  " S\%" \,RZ                  " 5       S-
  5      S 95      S% 5       5       r.\/R`                  Rb                  \ " SX0 \!D6\"" \#RH                  " S\%" \&RN                  " 5       S-
  5      S 9\#RH                  " S\%" \&RN                  " 5       S-
  5      S 9\#RH                  " S\%" \,RZ                  " 5       S-
  5      S 95      \)" SSS5      \)" S#S#S#5      \)" S&\%" \&RN                  " 5       S&-
  5      S5      \)" S&\%" \&RN                  " 5       S&-
  5      S#5      S' 5       5       5       5       5       5       5       r2S( r3\/R`                  Rb                  \ " SX0 \!D6\"" \#RH                  " S\%" \&RN                  " 5       S-
  5      S 9\#RH                  " S\%" \&RN                  " 5       S-
  5      S 9\#Rh                  " \#RH                  " S\%" \,RZ                  " 5       S-
  5      S 9S&S&S)S*95      \)" S&S&S&S/5      \)" S&S&S&S#/5      \)" S&\%" \&RN                  " 5       S&-
  5      S&S#/5      \)" S&\%" \&RN                  " 5       S&-
  5      S&S/5      S+ 5       5       5       5       5       5       5       r5S, r6S- r7S. r8S/ r9S0 r:S1 r;S2 r<S3 r=S4 r>S5 r?S6 r@S7 rAS8 rBS9 rCS: rDS; rES< rFS= rGS> rH\"" \#RH                  " S\%" \IRN                  " 5       S-
  5      S 9\#RH                  " S\%" \IRN                  " 5       S-
  5      S 9\#RH                  " S\%" \IRN                  " 5       S-
  5      S 95      \)" S?S&S@5      SA 5       5       rJSB rKSC rLSD rMSE rNSF rOSG rPSH rQSI rRSJ rSSK rTSL rUSM rVSN rWSO rX\/R`                  Rb                  \ " SX0 \YD6\/R`                  R                  \[R                  " 5       SP:H  SQSR9\"" \#RH                  " SSSS 95      ST 5       5       5       5       r]\/R`                  Rb                  \/R`                  R                  \[R                  " 5       SU:H  =(       d    \[R                  " 5       SP:H  SVSR9SW 5       5       r_SXr`gY)Z
TestJacobi+   c                 B   [        5       nSnSnSnSn[        XX4U5      nU R                  UR                  5       U5        U R	                  UR                  5       U5        U R                  UR                  5       U5        U R                  UR                  5       U5        g )Nr      r      )objectr	   assertEqualorderassertIscurvexy)selfr$   r%   r&   zr"   pjs          XC:\Users\julio\Documents\inmobiliaria_backend\env\Lib\site-packages\ecdsa/test_jacobi.pytest___init__TestJacobi.test___init__,   s    1/U+bhhj%(##    c                     [         R                  " [        5      n[         R                  " [        5      nU R	                  [
        5         X-     S S S 5        g ! , (       d  f       g = fN)r	   from_affiner   r   assertRaises
ValueErrorr'   p_ap_bs      r*   test_add_with_different_curves)TestJacobi.test_add_with_different_curves9   sA    %%m4%%m4z*I +**s   
A
A&c                 8    U R                  [        [        5        g r/   )assertNotEqualr   r   r'   s    r*   test_compare_different_curves(TestJacobi.test_compare_different_curves@   s    M=9r-   c                 \    [         R                  " [        5      nU R                  US5        g )Nvaluer	   r0   r   r9   r'   r)   s     r*   test_equality_with_non_point'TestJacobi.test_equality_with_non_pointC   s"    $$]3B(r-   c                     [         R                  " [        5      nUR                  5       nU R	                  [        U5        g r/   r	   r0   r   	to_affiner!   r'   r)   pws      r*   test_conversionTestJacobi.test_conversionH   s-    $$]3\\^+r-   c                 :   [         R                  " [        5      n[        R                  " 5       nUR                  5       nU R	                  UR                  5       UR                  5       5        U R	                  UR                  5       UR                  5       5        g r/   )r	   r0   r   doubler!   r%   r&   rF   s      r*   test_single_doubleTestJacobi.test_single_doubleN   sc    $$]3!!#YY[((r-   c                 t    [        [        SSS5      nUR                  5       nU R                  U[        5        g Nr   r   r	   r   rK   r#   r
   r@   s     r*   test_double_with_zero_point&TestJacobi.test_double_with_zero_pointW   +    Aq!,YY[b(#r-   c                 t    [        [        SSS5      nUR                  5       nU R                  U[        5        g Nr   rP   r@   s     r*   &test_double_with_zero_equivalent_point1TestJacobi.test_double_with_zero_equivalent_point^   rS   r-   c                     [        [        SS[        R                  " 5       5      nUR                  5       nU R	                  U[
        5        g rO   r	   r   prK   r#   r
   r@   s     r*   <test_double_with_zero_equivalent_point_non_zero_z_non_zero_yGTestJacobi.test_double_with_zero_equivalent_point_non_zero_z_non_zero_ye   1    Aq)++-8YY[b(#r-   c                     [        [        SS[        R                  " 5       5      nUR                  5       nU R	                  U[
        5        g rU   rY   r@   s     r*   1test_double_with_zero_equivalent_point_non_zero_z<TestJacobi.test_double_with_zero_equivalent_point_non_zero_zl   r]   r-   c                     [         R                  " [        5      nUR                  5       nU R	                  X5        U R	                  X!5        g r/   rD   r'   r)   pas      r*   test_compare_with_affine_point)TestJacobi.test_compare_with_affine_points   s9    $$]3\\^  r-   c                 t    [        [        SSS5      nUR                  5       nU R                  U[        5        g rU   )r	   r   rE   r#   r
   rb   s      r*   test_to_affine_with_zero_point)TestJacobi.test_to_affine_with_zero_pointz   s+    Aq!,\\^b(#r-   c                     [         R                  " [        5      nUR                  5       nX-   nU R	                  X1R                  5       5        g r/   r	   r0   r   rE   r!   rK   r'   r)   rc   ss       r*   test_add_with_affine_point%TestJacobi.test_add_with_affine_point   8    $$]3\\^GIIK(r-   c                     [         R                  " [        5      nUR                  5       nX!-   nU R	                  X1R                  5       5        g r/   rj   rk   s       r*   test_radd_with_affine_point&TestJacobi.test_radd_with_affine_point   ro   r-   c                 l    [         R                  " [        5      nU[        -   nU R	                  X!5        g r/   )r	   r0   r   r
   r!   )r'   r)   rl   s      r*   test_add_with_infinity!TestJacobi.test_add_with_infinity   s)    $$]3Mr-   c                     [         R                  " [        5      R                  5       n[        [        SSS5      nX!-   nU R                  X15        g rU   )r	   r0   r   rE   r   r#   )r'   rc   r)   rl   s       r*   test_add_zero_point_to_affine(TestJacobi.test_add_zero_point_to_affine   s>    $$]3==?Aq!,Gar-   c                 n    [         R                  " [        5      nUS-  nU R                  U[        5        g rU   )r	   r0   r   r#   r
   r@   s     r*   test_multiply_by_zero TestJacobi.test_multiply_by_zero   s)    $$]3!Vb(#r-   c                 ^    [        [        SSS5      nUS-  nU R                  U[        5        g rO   )r	   r   r#   r
   r@   s     r*   test_zero_point_multiply_by_one*TestJacobi.test_zero_point_multiply_by_one   s)    Aq!,!Vb(#r-   c                    [         R                  " [        5      n[        S-  nUS-  nU R                  UR	                  5       UR	                  5       5        U R                  UR                  5       UR                  5       5        g Nr   r	   r0   r   r!   r%   r&   rF   s      r*   test_multiply_by_oneTestJacobi.test_multiply_by_one   ]    $$]3Q!V((r-   c                    [         R                  " [        5      n[        S-  nUS-  nU R                  UR	                  5       UR	                  5       5        U R                  UR                  5       UR                  5       5        g Nr   r   rF   s      r*   test_multiply_by_twoTestJacobi.test_multiply_by_two   r   r-   c                 v    [         R                  " [        5      n[        S-  nSU-  nU R                  X5        g r   r	   r0   r   r!   rF   s      r*   test_rmul_by_twoTestJacobi.test_rmul_by_two   s3    $$]3QV r-   c                 d    [         R                  " [        5      nU R                  U[        5        g r/   )r	   r0   r   r9   r
   r@   s     r*   #test_compare_non_zero_with_infinity.TestJacobi.test_compare_non_zero_with_infinity   s"    $$]3B)r-   c                 T    [        [        SSS5      nU R                  U[        5        g )Nr   r   r	   r   r!   r
   r@   s     r*   -test_compare_non_zero_bad_scale_with_infinity8TestJacobi.test_compare_non_zero_bad_scale_with_infinity   s"    Aq!,X&r-   c                     [        SSS5      n[        USSS5      nU R                  UR                  SS5      5        U R	                  U[
        5        g N   r   r   r   r	   
assertTruecontains_pointr9   r
   r'   c_23r)   s      r*   "test_eq_x_0_on_curve_with_infinity-TestJacobi.test_eq_x_0_on_curve_with_infinity   I    r1a q!Q'++Aq12B)r-   c                     [        SSS5      n[        USSS5      nU R                  UR                  SS5      5        U R	                  U[
        5        g )Nr   r   r   r   r   r   s      r*   "test_eq_y_0_on_curve_with_infinity-TestJacobi.test_eq_y_0_on_curve_with_infinity   r   r-   c                 x    [        SSS5      n[        USSS5      n[        USSS5      nU R                  X#5        g )Nr   r   r      )r   r	   r9   )r'   r   r4   r5   s       r*   test_eq_with_same_x_different_y*TestJacobi.test_eq_with_same_x_different_y   s>    r1a $2q)$1a(C%r-   c                 T    [        [        SSS5      nU R                  U[        5        g rU   r   r@   s     r*   %test_compare_zero_point_with_infinity0TestJacobi.test_compare_zero_point_with_infinity   s"    Aq!,X&r-   c                     [         R                  " [        5      nUR                  5       nUS-  nU R	                  X#5        g r   )r	   r0   r   rK   r!   )r'   r)   dblmlpls       r*   !test_compare_double_with_multiply,TestJacobi.test_compare_double_with_multiply   s4    $$]3iikAv#r-   r   r   )	min_value	max_valuec                 $   [         R                  " [        5      nUR                  5       U-  nX!-  nU R	                  UR                  5       UR                  5       4UR                  5       UR                  5       45        U R	                  X#5        g r/   )r	   r0   r   rE   r!   r%   r&   )r'   mulr)   rG   s       r*   test_multiplicationsTestJacobi.test_multiplications   sl     $$%>?\\^c!X"$$&"$$&)BDDFBDDF+;< r-   c                     [         nU R                  UR                  5        [        R                  " [         5      nX!-  nX1-  nU R                  XE5        g r/   )r   r   _PointJacobi__precomputer	   r0   r!   )r'   r   precompr)   abs         r*   test_precomputeTestJacobi.test_precompute  sH     ,889$$%>?MHr-   r   c                     [         R                  " [        5      n[         R                  " X1-  5      n[         R                  " X2-  5      nXE-   nU R                  XcX-   -  5        g r/   )r	   r0   r   r!   )r'   a_mulb_mulj_gr   r   cs          r*   test_add_scaled_points!TestJacobi.test_add_scaled_points  sU     %%&?@##CK0##CK0E5=12r-   c                    [         R                  " [        5      n[         R                  " XA-  5      n[         R                  " XB-  5      n[        R                  " 5       n[        [        X75      5        X3-  U-  n[        [        UR                  5       U-  U-  UR                  5       U-  U-  U-  U5      nXV-   n	U R                  XX-   -  5        g r/   
r	   r0   r   r   rZ   r   r   r%   r&   r!   
r'   r   r   new_zr   r   r   rZ   new_zzr   s
             r*   test_add_one_scaled_point$TestJacobi.test_add_one_scaled_point(  s     %%&?@##CK0##CK0!##%{5$%"!CCEFNQCCEFNU"Q&	
 E5=12r-   r   c                     [         R                  " [        5      n[         R                  " XA-  5      n[         R                  " XB-  5      n[        R                  " 5       n[        [        X75      5        X3-  U-  n[        [        UR                  5       U-  U-  UR                  5       U-  U-  U-  U5      n[        [        UR                  5       U-  U-  UR                  5       U-  U-  U-  U5      nXV-   n	U R                  XX-   -  5        g r/   r   r   s
             r*   test_add_same_scale_points%TestJacobi.test_add_same_scale_pointsH  s      %%&?@##CK0##CK0!##%{5$%"!CCEFNQCCEFNU"Q&	
 !CCEFNQCCEFNU"Q&	
 E5=12r-   c                    [         n[        R                  " 5       nUS-  nUR                  5         Sn[	        [        UR                  5       US-  -  U-  UR                  5       US-  -  U-  U5      n[	        [        UR                  5       US-  -  U-  UR                  5       US-  -  U-  U5      nX3-   nU R                  XuU-   5        g )N      r   r   r   r   rZ   scaler	   r%   r&   r!   )r'   r   rZ   r   z1r%   r&   r   s           r*   !test_add_same_scale_points_static,TestJacobi.test_add_same_scale_points_statics  s    '!##%"H		!CCEBEMACCEBEMA	
 !CCEBEMACCEBEMA	
 EE"r-   T)min_sizemax_sizeuniquec                    [         R                  " [        5      n[         R                  " XA-  5      n[         R                  " XB-  5      n[        R                  " 5       n[        [        US   U5      5        [        [        US   U5      5        US   US   -  U-  nUS   US   -  U-  n	[        [        UR                  5       U-  U-  UR                  5       U-  US   -  U-  US   5      n[        [        UR                  5       U	-  U-  UR                  5       U	-  US   -  U-  US   5      nXV-   n
U R                  XX-   -  5        g rO   r   )r'   r   r   r   r   r   r   rZ   new_zz0new_zz1r   s              r*   test_add_different_scale_points*TestJacobi.test_add_different_scale_points  s=   . %%&?@##CK0##CK0!##%{58Q'({58Q'((U1X%)(U1X%)!CCEGOaCCEGOeAh&*!H	
 !CCEGOaCCEGOeAh&*!H	
 E5=12r-   c                    [         n[        R                  " 5       nUS-  nUR                  5         Sn[	        [        UR                  5       US-  -  U-  UR                  5       US-  -  U-  U5      nSn[	        [        UR                  5       US-  -  U-  UR                  5       US-  -  U-  U5      nX3-   nU R                  XU-   5        g )Nr   r   r   r      r   )	r'   r   rZ   r   r   r%   z2r&   r   s	            r*   &test_add_different_scale_points_static1TestJacobi.test_add_different_scale_points_static  s    '!##%"H		!CCEBEMACCEBEMA	
 !CCEBEMACCEBEMA	
 EE"r-   c                    [         n[        R                  " 5       nUS-  nUR                  5         US-  nSn[	        [        UR                  5       US-  -  U-  UR                  5       US-  -  U-  U5      n[	        [        UR                  5       US-  -  U-  UR                  5       US-  -  U-  U5      nX4-   nU R                  XU-   5        g )Nr      r   r   r   r   )	r'   r   rZ   r   r   r(   r%   r&   r   s	            r*   +test_add_different_points_same_scale_static6TestJacobi.test_add_different_points_same_scale_static  s    '!##%"H		"H!CCEAqDL1CCEAqDL1	
 !CCEAqDL1CCEAqDL1	
 EE"r-   c                 r   [         n[        R                  " 5       nSnX-  nUR                  5         [	        [        UR                  5       US-  -  U-  UR                  5       US-  -  U-  U5      n[	        [        UR                  5       UR                  5       S5      nXD-   nU R                  XuU-   5        g )Nr   r   r   r   )r   r   rZ   r   r	   r%   r&   r!   )r'   r   rZ   r(   r   r%   r&   r   s           r*   5test_add_same_point_different_scale_second_z_1_static@TestJacobi.test_add_same_point_different_scale_second_z_1_static  s    MMOG		CCEAqDL1CCEAqDL1	
 CCECCE	
 EE"r-   c                 *   [         nSnX-  nUR                  5         U* n[        [        UR	                  5       UR                  5       S5      n[        [        UR	                  5       UR                  5       S5      nU R                  [        XV-   5        g )Nr   r   )r   r   r	   r   r%   r&   r!   r
   )r'   r   r(   r   r   r%   r&   s          r*   test_add_to_infinity_static&TestJacobi.test_add_to_infinity_static  s}    G		BCCECCE	
 CCECCE	
 	15)r-   c                 l    [         R                  " [        5      nU R                  US-  X-   U-   5        g )Nr   r   r'   r   s     r*   test_add_point_3_times!TestJacobi.test_add_point_3_times  s,    %%m4q#)c/2r-   c                     [        [        [        R                  " 5       [        R                  " 5       S5      nU R                  U[        R                  " 5       -  [        5        g r   )r	   r   r   r%   r&   r!   r"   r
   r   s     r*   test_mul_without_order!TestJacobi.test_mul_without_order#  s>    )]__%68I1M}2244h?r-   c                     [         R                  " [        5      nU R                  XR	                  S[
        S5      5        g r   r	   r0   r   r!   mul_addr
   r   s     r*   test_mul_add_infTestJacobi.test_mul_add_inf(  s-    %%m4kk!Xq9:r-   c                     [         R                  " [        5      nU R                  US-  UR	                  SUS5      5        g )Nr   r   r	   r0   r   r!   r   r   s     r*   test_mul_add_sameTestJacobi.test_mul_add_same-  s3    %%m4q#++aa"89r-   c                 $   [         R                  " [        S5      n[         R                  " US-  S5      nU R                  US-  X-   5        U R                  US-  US-  US-  -   5        U R                  US-  UR	                  SUS5      5        g )NT      i     r   r	   r0   r   r!   r   r'   r   r   s      r*   test_mul_add_precompute"TestJacobi.test_mul_add_precompute2  s    %%&?F##C#It4sCG,,cAgAo>,ckk!Q.BCr-   c                 $   [         R                  " [        S5      n[         R                  " US-  S5      nU R                  US-  X-   5        U R                  US-  US-  US-  -   5        U R                  US-  UR	                  SUS5      5        g )NTr   r         r   r   s      r*   test_mul_add_precompute_large(TestJacobi.test_mul_add_precompute_large:  s    %%&?F##C#It4sCG,()3<!f*+D	
 	()3;;vq&+I	
r-   c                     [         R                  " [        5      nUS-  nUR                  SUS5      nU R	                  X#5        g )Nr   r   r   )r	   r0   r   r   r!   )r'   r   r   r   s       r*   test_mul_add_to_mulTestJacobi.test_mul_add_to_mulF  s;    %%m4!GKK3"r-   c                     [         R                  " [        5      nUS-  nU R                  UR	                  SUS5      US-  5        g )Nr   r   r   r   )r'   r   w_as      r*   test_mul_add_differnt TestJacobi.test_mul_add_differntN  s<    %%m4AgQQ/q9r-   c                     [         R                  " [        5      nUS-  nUS-  nU R                  UR	                  SUS5      US-  US-  -   5        g )Nr   r   r   r   )r'   r   r  w_bs       r*   test_mul_add_slightly_different*TestJacobi.test_mul_add_slightly_differentU  sN    %%m4AgAgQQ/q371BCr-   c                     [         R                  " [        5      n[        S-  n[        S-  nUS-  nUR                  SUS5      nU R	                  UR                  5       X#-   5        g )Nr   i        r	   r0   r   r   r!   rE   r'   r   r  r  j_brets         r*   test_mul_addTestJacobi.test_mul_add]  sY    %%m4c!{+Djkk#sD)#)4r-   c                     [         R                  " [        5      n[        S-  n[        S-  nUS-  nUR                  SUS5      nU R	                  UR                  5       X#-   5        g )Nr   r   r  r  r  s         r*   test_mul_add_zeroTestJacobi.test_mul_add_zeroh  sY    %%m4c!x(Djkk#sA&#)4r-   c                     [         R                  " [        5      n[         R                  " US-  5      nU R                  US-  X-   5        U R                  US-  US-  US-  -   5        U R                  US-  UR	                  SUS5      5        g )Nr   r   r  r  r  r   r   s      r*   test_mul_add_largeTestJacobi.test_mul_add_larget  s    %%m4##C#I.sCG,()3<!f*+D	
 	()3;;vq&+I	
r-   c                     [         R                  " [        5      n[        R                  " 5       n[         R                  " [        S-  5      nU R	                  UR                  US-  X2S-  5      [        5        g )Nr   )r	   r0   r   r"   r!   r   r
   )r'   r   r"   r   s       r*   $test_mul_add_with_infinity_as_result/TestJacobi.test_mul_add_with_infinity_as_result  sX    %%m4##%##MC$78US[!c\BHMr-   c                    [        [        [        R                  " 5       [        R                  " 5       S5      n[        R
                  " 5       n[        S-  nUR                  5         [        [        UR                  5       UR	                  5       S5      nU R                  UR                  US-  XBS-  5      [        5        g )Nr   "   )
r	   r   r   r%   r&   r"   r   r!   r   r
   )r'   r   r"   r  r   s        r*   test_mul_add_without_order%TestJacobi.test_mul_add_without_order  s    )]__%68I1M##%b 			3557CEEGQ7URZRK@(Kr-   c                     [         R                  " [        S-  5      nSU* -  nU R                  UR	                  SUS5      [
        5        g )N   r   r   r   )r'   r   dbl_negs      r*   ,test_mul_add_with_doubled_negation_of_itself7TestJacobi.test_mul_add_with_doubled_negation_of_itself  s?    %%mb&89t*Q3X>r-   i  i  c                     [         R                  " [        5      n[        U-  nUR                  XU5      nU R	                  XdU-  XS-  -   5        g r/   )r	   r0   r   r   r!   )r'   mul1mul2mul3r4   r5   ress          r*   test_mul_add_randomTestJacobi.test_mul_add_random  sG     %%o6$kk$T*Dj3:56r-   c                     [        [        SSSS5      SSSSS9n[        [        SSSS5      SSSSS9nU R                  X5        g Nr   r   r   r   r$   r%   r&   r(   r"   )r	   r   r!   )r'   pj1pj2s      r*   test_equalityTestJacobi.test_equality  sJ    Aq! 4Q!1MAq! 4Q!1M"r-   c                 \    [         R                  " [        5      nU R                  US5        g )Nr   r?   r   s     r*   !test_equality_with_invalid_object,TestJacobi.test_equality_with_invalid_object  s"    %%m4C$r-   c                     [         R                  " [        5      n[         R                  " [        5      nU R	                  X5        g r/   )r	   r0   r   r   r9   r3   s      r*   test_equality_with_wrong_curves*TestJacobi.test_equality_with_wrong_curves  s0    %%m4%%m4C%r-   c           	          [        [        SSSS5      SSSSS9nUR                  SSSSSSS5      u  p#nU R                  X#U4S5        g )	Nr   r   r   r   r8  r   r   )r   r   r   )r	   r   _addr!   )r'   r9  r%   r&   r(   s        r*   test_add_with_point_at_infinity*TestJacobi.test_add_with_point_at_infinity  sQ    Aq! 4Q!1M((1aAq!R0a!I.r-   c                 ^   [        SSS5      n[        USSS5      nUR                  5       nU R                  UR	                  5       UR                  5       4S5        U R                  U[        5        UR                  5       nU R                  U[        5        U R                  U[        5        g Nr   r   r      r   r   )	r   r	   rK   r!   r%   r&   r9   r
   r#   r'   r   rZ   p2p3s        r*   test_double_to_infinity"TestJacobi.test_double_to_infinity  s    r1a b"a(XXZ"$$&"$$&)62B)YY[X&b(#r-   c                     [        SSS5      n[        USSS5      nUR                  5       nU R                  UR	                  5       UR                  5       4S5        g )Nr   r   r   	   )r      )r   r	   rK   r!   r%   r&   )r'   c_23_2rZ   rL  s       r*   test_double_to_x_0TestJacobi.test_double_to_x_0  sL    Q"1a(XXZ"$$&"$$&)73r-   c                 2   [        SSS5      n[        USSS5      nUS-  nU R                  UR                  5       UR	                  5       4S5        U R                  U[        5        US-  nU R                  U[        5        U R                  U[        5        g )Nr   r   r   rI  r   rJ  r   r	   r!   r%   r&   r9   r
   r#   rK  s        r*   test_mul_to_infinityTestJacobi.test_mul_to_infinity  s    r1a b"a(U"$$&"$$&)62B)!VX&b(#r-   c                 .   [        SSS5      n[        USSS5      nX"-   nU R                  UR                  5       UR	                  5       4S5        U R                  U[        5        X3-   nU R                  U[        5        U R                  U[        5        g rH  rW  rK  s        r*   test_add_to_infinityTestJacobi.test_add_to_infinity  s}    r1a b"a(U"$$&"$$&)62B)WX&b(#r-   c                     [        SSS5      n[        USSS5      nUS-  nU R                  UR                  5       UR	                  5       4S5        g )Nr   r   rQ  r   r   r   r   r   r	   r!   r%   r&   r'   r   rZ   rL  s       r*   test_mul_to_x_0TestJacobi.test_mul_to_x_0  sJ    r1a aA&V"$$&"$$&)73r-   c                     [        SSS5      n[        USSS5      nUS-  nU R                  UR                  5       UR	                  5       4S5        g )Nr   r   rQ  r      rJ  r_  r`  s       r*   test_mul_to_y_0TestJacobi.test_mul_to_y_0  sJ    r1a aA&V"$$&"$$&)62r-   c                     [        SSS5      n[        USSS5      nUS-  U-   nU R                  UR                  5       UR	                  5       4S5        g )Nr   r   rQ  r   r   r^  r_  r`  s       r*   test_add_to_x_0TestJacobi.test_add_to_x_0  sN    r1a aA&VaZ"$$&"$$&)73r-   c                     [        SSS5      n[        USSS5      nUS-  U-   nU R                  UR                  5       UR	                  5       4S5        g )Nr   r   rQ  r   r   rJ  r_  r`  s       r*   test_add_to_y_0TestJacobi.test_add_to_y_0  sN    r1a aA&VaZ"$$&"$$&)62r-   c                 |    [        SSS5      n[        USSS5      nUS-  US-  -   nU R                  U[        5        g )Nr   r   rQ  r   rI     )r   r	   r#   r
   )r'   r   rZ   r   s       r*   test_add_diff_z_to_infinity&TestJacobi.test_add_diff_z_to_infinity  s?    r1a aA&FQUNa"r-   c                     [        [        SSSS5      SSSSS9nU R                  [        R                  " [        R
                  " U5      5      U5        g r7  )r	   r   r!   pickleloadsdumpsr@   s     r*   test_pickleTestJacobi.test_pickle  sA    wr1a3qA!Lfll2&67<r-   PyPyz!threading on PyPy breaks coverage)reasonr   c                 (   [         S-    [         n[        UR                  5       UR                  5       UR	                  5       SUR                  5       S5      nU R                  UR                  / 5        S n/ n[        U5       H'  nUR                  [        R                  " X24S95        M)     U H  nUR                  5         M     U" U5        U H  nUR                  5         M     U R                  UR                  [         R                  5        g )Nr   r   Tc                 d    U R                  5       n[        S5       H  nU [        U5      -    M     g )Nr   r"   ranger   	generatorr"   _s      r*   runner.TestJacobi.test_multithreading.<locals>.runner  )    OO%E2YIe,, r-   targetargs)r   r	   r$   r%   r&   r"   r!   r   r|  append	threadingThreadstartjoin)r'   
thread_numgenr  threadsr  ts          r*   test_multithreadingTestJacobi.test_multithreading  s     	! #))+suuwCIIKN55r:	-
 z"ANN9++6GH # AGGI  	sAFFH  	((44	
r-   WindowszFthere are no signals on Windows, and threading breaks coverage on PyPyc                    Sn[         S-    [         n[        UR                  5       UR                  5       UR	                  5       SUR                  5       S5      nU R                  UR                  / 5        S nS n/ n[        U5       H'  nUR                  [        R                  " X24S95        M)     [        R                  " 5       nUR                  5         [        R                  " 5       nUR                  5         [        R                  " 5       n	U	R                  5         UR                  [        R                  " UXxU	4S95        U H  n
U
R                  5         M     U R                  [         5         UR                  5         UR#                  5         U" U5        U	R                  5         S S S 5        U H  n
U
R%                  5         M     U R                  UR                  [         R                  5        g ! , (       d  f       NR= f)Nr   r   r   Tc                 d    U R                  5       n[        S5       H  nU [        U5      -    M     g )N2   r{  r}  s      r*   r  >TestJacobi.test_multithreading_with_interrupts.<locals>.runnerE  r  r-   c                     U R                  5         UR                  5         [        R                  " [        R                  " 5       [
        R                  5        UR                  5         g r/   )releaseacquireoskillgetpidsignalSIGINT)barrier_startbarrier_end	lock_exits      r*   interrupterCTestJacobi.test_multithreading_with_interrupts.<locals>.interrupterJ  s>    !!#!GGBIIK/r-   r  )r   r	   r$   r%   r&   r"   r!   r   r|  r  r  r  Lockr  r  r1   KeyboardInterruptr  r  )r'   r  r  r  r  r  r  r  r  r  r  s              r*   #test_multithreading_with_interrupts.TestJacobi.test_multithreading_with_interrupts3  s    
! #))+suuwCIIKN55r:	-
	  z"ANN9++6GH # "(nn&NN$	"#)<	
 AGGI  01!!#!3K  2 AFFH  	((44	
 21s   79G<<
H
 N)a__name__
__module____qualname____firstlineno__r+   r6   r;   rA   rH   rL   rQ   rV   r[   r_   rd   rg   rm   rq   rt   rw   rz   r}   r   r   r   r   r   r   r   r   r   r   r   SLOW_SETTINGSr   stintegersintr   r"   r   r   r   r   r   rZ   r   pytestmarkslowr   r   listsr   r   r   r   r   r   r   r   r   r  r  r
  r  r  r  r  r!  r$  r(  r-  r   r4  r;  r>  rA  rE  rN  rT  rX  r[  ra  re  rh  rk  ro  ru  NO_OLD_SETTINGSskipifplatformpython_implementationr  systemr  __static_attributes__r  r-   r*   r   r   +   s   $:)
,)$$$$!$)) $$))!*
'**&'
$ 

3'@'F'F'H1'L#M	

! ! 

3'@'F'F'H1'L#M	

 QZS*00234 5   

3'@'F'F'H1'L#M	
 	3'@'F'F'H1'L#M	
	 Q]3  3 

3'@'F'F'H1'L#M	
 	3'@'F'F'H1'L#M	
 	a3/D/F/F/H1/L+MN3 3, [[

3'@'F'F'H1'L#M	
 	3'@'F'F'H1'L#M	
 	a3/D/F/F/H1/L+MN Q1Q1Q-3359:A>Q-3359:A>3 ? ?    38#. [[

3'@'F'F'H1'L#M	
 	3'@'F'F'H1'L#M	
 	KKs+@+B+B+Dq+H'I 	
  QAq6QAq6Q-3359:QFCQ-3359:QFC3 D D  !  ,3<#0#0#0*03
@
;
:
D

:D	5
5

N
L? 
a3/D/D/F/J+KL
a3/D/D/F/J+KL
a3/D/D/F/J+KL
 S!T7 7#
%
&/$4$$4343#= [[  [[&&(F22   2;;b12
 3	 ! 
@ [[[[Y& 	6))+v5  ;
 ;
r-   r   c                   B    \ rS rSrSrS rS rS rS rS r	S r
S	 rS
rg)TestZeroCurveix  z.Tests with curve that has (0, 0) on the curve.c                 (    [        SSS5      U l        g r   )r   r$   r:   s    r*   setUpTestZeroCurve.setUp{  s    RA&
r-   c                 Z    U R                  U R                  R                  SS5      5        g rU   )r   r$   r   r:   s    r*   test_zero_point_on_curve&TestZeroCurve.test_zero_point_on_curve~  s    

11!Q78r-   c                     [        U R                  SSS5      nUR                  5       nU R                  U[        5        U R                  SUR                  5       UR                  5       45        g )Nr   rR  r   r   r	   r$   rK   r9   r
   r!   r%   r&   r'   rZ   ds      r*   test_double_to_0_0_point&TestZeroCurve.test_double_to_0_0_point  sQ    

Ar1-HHJAx(!##%0r-   c                     Sn[        U R                  SUS-  -  SUS-  -  U5      nUR                  5       nU R                  U[        5        U R                  SUR                  5       UR                  5       45        g )Nr   r   rR  r   r  r  )r'   r(   rZ   r  s       r*   'test_double_to_0_0_point_with_non_one_z5TestZeroCurve.test_double_to_0_0_point_with_non_one_z  sf    

A1Hb1a4i;HHJAx(!##%0r-   c                     [        U R                  SSS5      nUS-  nU R                  U[        5        U R	                  SUR                  5       UR                  5       45        g )Nr   r   r   r   r  )r	   r$   r9   r
   r!   r%   r&   r  s      r*   test_mul_to_0_0_point#TestZeroCurve.test_mul_to_0_0_point  sO    

BA.FAx(!##%0r-   c                     [        U R                  SSS5      nUR                  5       nU R                  U[        5        g rO   )r	   r$   rK   r#   r
   r  s      r*   test_double_of_0_0_point&TestZeroCurve.test_double_of_0_0_point  s/    

Aq!,HHJa"r-   c                     [        U R                  SSS5      n[        U R                  SS5      n[        S5       H  nU R	                  X-  X#-  5        M     g )Nr   r   r      )r	   r$   r   r|  r!   )r'   rZ   p_cis       r*   "test_compare_to_old_implementation0TestZeroCurve.test_compare_to_old_implementation  sJ    

BA.DJJB'rAQUCG, r-   )r$   N)r  r  r  r  __doc__r  r  r  r  r  r  r  r  r  r-   r*   r  r  x  s(    8'9111#-r-   r  )*rr  sys	unittest2unittestImportErrorr  r  r  r  r  hypothesis.strategies
strategiesr  
hypothesisr   r   r   r   ellipticcurver   r	   r
   r   ecdsar   r   r   r   r   r   r   numbertheoryr   utilr   r  version_infor  argvTestCaser   r  r  r-   r*   <module>r     s     
  
     " 7 7 @ @   &  f"&OJ sxx$%M.!$&M.!J
"" J
Z.-H%% .-e  s   B= =
C
	C
