ó
‹wÛjc           @   ss  d  Z  d d l m Z d d l m Z d d l Z d d l Z d d l Z d d l Z d d l	 Z	 d d l
 Z
 d d l m Z m Z d d l m Z m Z e j Z e j Z e
 j e j d ƒ j d ƒ d	 ƒ Z d
 e f d „  ƒ  YZ d e f d „  ƒ  YZ d e j f d „  ƒ  YZ d e
 j f d „  ƒ  YZ d „  Z d e
 j f d „  ƒ  YZ d „  Z  e! d k roe  ƒ  n  d S(   s   Tests for Lib/fractions.py.iÿÿÿÿ(   t   Decimal(   t   run_unittestN(   t   copyt   deepcopy(   t   dumpst   loadst   doublet   IEEEs   test requires IEEE 754 doublest
   DummyFloatc           B   sk   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d „  Z
 d	 „  Z e Z d
 Z RS(   s8   Dummy float class for testing comparisons with Fractionsc         C   s+   t  | t ƒ s t d ƒ ‚ n  | |  _ d  S(   Ns-   DummyFloat can only be initialized from float(   t
   isinstancet   floatt	   TypeErrort   value(   t   selfR   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   __init__   s    c         C   sU   t  | t j ƒ r+ | t j |  j ƒ | ƒ St  | t ƒ rM | |  j | j ƒ St Sd  S(   N(   R	   t   numberst   Rationalt   Ft
   from_floatR   R   t   NotImplemented(   R   t   othert   op(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   _richcmp   s
    c         C   s   |  j  | t j ƒ S(   N(   R   t   operatort   eq(   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   __eq__%   t    c         C   s   |  j  | t j ƒ S(   N(   R   R   t   le(   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   __le__&   R   c         C   s   |  j  | t j ƒ S(   N(   R   R   t   lt(   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   __lt__'   R   c         C   s   |  j  | t j ƒ S(   N(   R   R   t   ge(   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   __ge__(   R   c         C   s   |  j  | t j ƒ S(   N(   R   R   t   gt(   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   __gt__)   R   c         C   s   d  S(   N(    (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt	   __float__,   s    c         C   s   d  S(   N(    (   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   __sub__0   s    N(   t   __name__t
   __module__t   __doc__R   R   R   R   R   R    R"   R#   R$   t   __rsub__t   Nonet   __hash__(    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyR      s   									t   DummyRationalc           B   sS   e  Z d  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z	 d Z RS(	   sA   Test comparison of Fraction with a naive rational implementation.c         C   s-   t  | | ƒ } | | |  _ | | |  _ d  S(   N(   t   gcdt   numt   den(   R   R-   R.   t   g(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyR   ;   s    c         C   s<   t  | t j ƒ r4 |  j | j k o3 |  j | j k St Sd  S(   N(   R	   t	   fractionst   FractionR-   t
   _numeratorR.   t   _denominatorR   (   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyR   @   s    c         C   s   |  j  | j |  j | j k  S(   N(   R-   R3   R.   R2   (   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyR   G   s    c         C   s   |  j  | j |  j | j k S(   N(   R-   R3   R.   R2   (   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyR"   J   s    c         C   s   |  j  | j |  j | j k S(   N(   R-   R3   R.   R2   (   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyR   M   s    c         C   s   |  j  | j |  j | j k S(   N(   R-   R3   R.   R2   (   R   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyR    P   s    c         C   s   d  S(   N(    (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyR#   U   s    N(   R%   R&   R'   R   R   R   R"   R   R    R#   R)   R*   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyR+   8   s   							t   DummyFractionc           B   s   e  Z d  Z RS(   s6   Dummy Fraction subclass for copy and deepcopy testing.(   R%   R&   R'   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyR4   \   s   t   GcdTestc           B   s   e  Z d  „  Z RS(   c         C   sþ   |  j  d t d d ƒ ƒ |  j  d t d d ƒ ƒ |  j  d t d d ƒ ƒ |  j  d t d d ƒ ƒ |  j  d t d d ƒ ƒ |  j  d t d d ƒ ƒ |  j  d t d d ƒ ƒ |  j  d t d d ƒ ƒ |  j  d t d d	 ƒ ƒ |  j  d
 t d	 d ƒ ƒ d  S(   Ni    i   iÿÿÿÿi   iéÿÿÿi   i   ix   iT   iôÿÿÿiˆÿÿÿ(   t   assertEqualR,   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testMisca   s    (   R%   R&   R7   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyR5   _   s   c         C   s   |  j  |  j f S(   N(   t	   numeratort   denominator(   t   r(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   _componentsn   s    t   FractionTestc           B   s
  e  Z d  „  Z d „  Z d „  Z e d „  ƒ Z d „  Z d „  Z d „  Z	 d „  Z
 d „  Z d	 „  Z d
 „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   s0   |  j  t | ƒ t | ƒ ƒ |  j  | | ƒ d S(   s4   Asserts that both the types and values are the same.N(   R6   t   type(   R   t   expectedt   actual(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   assertTypedEqualst   s    c         O   sU   y | | | Ž  Wn) | k
 r< } |  j  | t | ƒ ƒ n X|  j d | j ƒ d S(   s@   Asserts that callable(*args, **kwargs) raises exc_type(message).s   %s not raisedN(   R6   t   strt   failR%   (   R   t   exc_typet   messaget   callablet   argst   kwargst   e(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   assertRaisesMessagey   s
    c         C   s  |  j  d t t ƒ  ƒ ƒ |  j  d t t d ƒ ƒ ƒ |  j  d t t t d d ƒ ƒ ƒ ƒ |  j  d  t t d d ƒ ƒ ƒ |  j  d! t t d d ƒ ƒ ƒ |  j  d" t t d d ƒ ƒ ƒ |  j  d# t t d d	 ƒ ƒ ƒ |  j  d$ t t d d
 ƒ ƒ ƒ |  j  d& t t d' ƒ ƒ ƒ |  j  d( t t t d d ƒ d ƒ ƒ ƒ |  j  d) t t d t d d ƒ ƒ ƒ ƒ |  j  d* t t t d d ƒ t d d ƒ ƒ ƒ ƒ |  j t d t d d ƒ |  j t t d+ ƒ |  j t t d d ƒ |  j t t d d ƒ |  j t t d d ƒ d  S(,   Ni    i   i   i   iÿÿÿÿiþÿÿÿi   i   i
   i   i   iM   i   i÷ÿÿÿiöÿÿÿi	   i¶	  iµ	  i   ic  iq   s   Fraction(12, 0)i   g      ø?y              @s   3/2y                y              ð?(   i    i   (   i   i   (   i   i   (   iÿÿÿÿi   (   iÿÿÿÿi   (   i   i   (   i   i   (   i   i   l      m+?ÐR (   l      m+?ÐR i   l      m+?ÐR (   i   iM   (   i÷ÿÿÿi   (   i¶	  iµ	  y      ø?      @(   R6   R;   R   RI   t   ZeroDivisionErrort   assertRaisesR   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testInitƒ   s$    %((1c         C   s£   |  j  d t t d ƒ ƒ ƒ |  j  d t t d ƒ ƒ ƒ |  j  d t t d	 ƒ ƒ ƒ |  j t t t d
 ƒ ƒ |  j t t t d ƒ ƒ |  j t t t d ƒ ƒ d  S(   Ni   i   g      @i    i   g       €IÍÌÌÌÌÌ I      € gš™™™™™¹?t   nant   infs   -inf(   i   i   (   i    i   (   IÍÌÌÌÌÌ I      € (   R6   R;   R   RK   R   R
   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testInitFromFloat›   s    	c         C   sÎ   |  j  d t t t d ƒ ƒ ƒ ƒ |  j  d t t t d ƒ ƒ ƒ ƒ |  j  d t t t d	 ƒ ƒ ƒ ƒ |  j t t t d
 ƒ ƒ |  j t t t d ƒ ƒ |  j t t t d ƒ ƒ |  j t t t d ƒ ƒ d  S(   Ni   i
   s   1.1i   iÈ   s   3.5e-2i    i   s   .000e20RM   t   snanRN   s   -inf(   i   i
   (   i   iÈ   (   i    i   (   R6   R;   R   R    RK   R   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testInitFromDecimal¥   s    			c         C   s„  |  j  d0 t t d ƒ ƒ ƒ |  j  d1 t t d ƒ ƒ ƒ |  j  d2 t t d ƒ ƒ ƒ |  j  d3 t t d	 ƒ ƒ ƒ |  j  d4 t t d ƒ ƒ ƒ |  j  d5 t t d ƒ ƒ ƒ |  j  d6 t t d ƒ ƒ ƒ |  j  d7 t t d ƒ ƒ ƒ |  j  d8 t t d ƒ ƒ ƒ |  j  d9 t t d ƒ ƒ ƒ |  j  d: t t d ƒ ƒ ƒ |  j  d; t t d ƒ ƒ ƒ |  j  d< t t d ƒ ƒ ƒ |  j  d= t t d ƒ ƒ ƒ |  j  d> t t d ƒ ƒ ƒ |  j t d t d ƒ |  j t d t d ƒ |  j t d  t d! ƒ |  j t d" t d# ƒ |  j t d$ t d% ƒ |  j t d& t d' ƒ |  j t d( t d) ƒ |  j t d* t d+ ƒ |  j t d, t d- ƒ |  j t d. t d/ ƒ d  S(?   Ni   i   t   5i   i   s   3/2s    
  +3/2iýÿÿÿs   -3/2  i   s       013/02 
  u       013/02 
  i   s    3.2 iðÿÿÿu    -3.2 u    -3. u    .6 i5  s   32.e-5i@B s   1E+06iôÏÿÿs   -1.23e4i    s    .0e+0	s   -0.000e0s   Fraction(3, 0)s   3/0s"   Invalid literal for Fraction: '3/'s   3/s"   Invalid literal for Fraction: '/2's   /2s$   Invalid literal for Fraction: '3 /2's   3 /2s$   Invalid literal for Fraction: '3/+2's   3/+2s%   Invalid literal for Fraction: '+ 3/2's   + 3/2s#   Invalid literal for Fraction: '3a2't   3a2s%   Invalid literal for Fraction: '3/7.2's   3/7.2s%   Invalid literal for Fraction: '3.2/7's   3.2/7s!   Invalid literal for Fraction: '.'t   .(   i   i   (   i   i   (   i   i   (   iýÿÿÿi   (   i   i   (   i   i   (   i   i   (   iðÿÿÿi   (   iýÿÿÿi   (   i   i   (   i   i5  (   i@B i   (   iôÏÿÿi   (   i    i   (   i    i   (   R6   R;   R   RI   RJ   t
   ValueError(   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testFromString±   sZ    








c         C   sÂ   t  d d ƒ } | j d d ƒ |  j d
 t | ƒ ƒ |  j t t | d d ƒ |  j t t | d d ƒ |  j d t | ƒ ƒ d	 | _ d | _ |  j d t | ƒ ƒ |  j	 t  d	 d ƒ | ƒ d  S(   Ni   i   i   i   R8   i   R9   i   i   (   i   i   (   i   i   (   i   i   (
   R   R   R6   R;   RK   t   AttributeErrort   setattrR2   R3   t   assertNotEqual(   R   R:   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testImmutableé   s    		c         C   sŸ  |  j  t t j d ƒ |  j d t t j d ƒ ƒ ƒ d } |  j | d f t t j | ƒ ƒ ƒ |  j d t t j d ƒ ƒ ƒ |  j d t t j d ƒ ƒ ƒ |  j d t t j d ƒ ƒ ƒ |  j d t t j d ƒ ƒ ƒ |  j t d ƒ t t j d ƒ ƒ ƒ |  j d t t j d ƒ ƒ ƒ |  j d t t j d ƒ ƒ ƒ d } | | } |  j t d t j | ƒ |  j t d t j | ƒ |  j t d t j | ƒ d  S(   Ni   y              @i
   i   I�é}ô"i    g       €g      $@iûÿÿÿi   g      Àl      l+?ÐR göJáÇ-µDi   IÍÌÌÌÌÌ I       gš™™™™™	@g      ðs   Cannot convert inf to Fraction.s    Cannot convert -inf to Fraction.s   Cannot convert nan to Fraction.y      @      @(   i
   i   (   i    i   (   i
   i   (   iûÿÿÿi   (   l      l+?ÐR i   l      m+?ÐR (   IÍÌÌÌÌÌ I       (   RK   R   R   R   R6   R;   R
   RI   (   R   t   bigintRN   RM   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testFromFloatù   s0    %	%	
c         C   s†  |  j  t t j d ƒ |  j t d d ƒ t j d ƒ ƒ |  j t d ƒ t j t d ƒ ƒ ƒ |  j t d d ƒ t j t d ƒ ƒ ƒ |  j t d d	 ƒ t j t d
 ƒ ƒ ƒ |  j t d ƒ t j t d ƒ ƒ ƒ |  j d t d d ƒ t j t d d d ƒ ƒ ƒ |  j t d t j t d ƒ ƒ |  j t d t j t d ƒ ƒ |  j t d t j t d ƒ ƒ |  j t d t j t d ƒ ƒ d  S(   Ni   y              @i
   i   i    s   -0i   s   0.5iè  s   5e-3iˆ  t   5e3i   s   0.t   9s$   Cannot convert Infinity to Fraction.RN   s%   Cannot convert -Infinity to Fraction.s   -infs   Cannot convert NaN to Fraction.RM   s    Cannot convert sNaN to Fraction.RP   y      @      @l       ©7§3M“e'(   RK   R   R   t   from_decimalR6   R    RI   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testFromDecimal  s(    "%((%c         C   sA  t  d ƒ } |  j | j d ƒ t  d d ƒ ƒ |  j | j d ƒ t  d d ƒ ƒ |  j | j d ƒ t  d d ƒ ƒ |  j | j d ƒ t  d d ƒ ƒ |  j t  d	 d
 ƒ j d ƒ t  d ƒ ƒ |  j t  d	 d
 ƒ j d ƒ t  d d ƒ ƒ |  j t  d ƒ j d ƒ t  d ƒ ƒ x- d D]% } |  j t d t  d ƒ j | ƒ qWd  S(   Ns   3.1415926535897932i'  ic  iq   i�þÿÿip   iM  ij   iÉ   iÈ   id   i   ie   if   i    iÿÿÿÿs$   max_denominator should be at least 1(   i    iÿÿÿÿ(   R   R6   t   limit_denominatorRI   RU   (   R   t   rpit   i(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testLimitDenominator+  s    "#""(+%c         C   sC  |  j  d t j t d d ƒ ƒ ƒ |  j  d t t d d ƒ ƒ ƒ |  j  d t j t d d ƒ ƒ ƒ |  j t t t d d ƒ ƒ ƒ |  j t t t d d ƒ ƒ ƒ |  j  d	 t	 t d d ƒ ƒ ƒ |  j
 t t	 t d
 d d ƒ ƒ |  j d d t	 t t d
 d d ƒ t d d d ƒ ƒ ƒ ƒ |  j  d t t d d ƒ ƒ ƒ d  S(   Niÿÿÿÿiõÿÿÿi
   i   i   i    i   i   gš™™™™™¹?t   2i�  t   7g       @t   3t   1y                yš™™™™™¹?        (   R@   t   matht   truncR   t   intR6   t   Falset   boolt   TrueR
   RK   t   OverflowErrort   longt   assertAlmostEqualt   complex(   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testConversions9  s    ""!2c         C   sû  |  j  t d d ƒ t d d ƒ t d d ƒ ƒ |  j  t d d ƒ t d d ƒ t d d ƒ ƒ |  j  t d d ƒ t d d ƒ t d d ƒ ƒ |  j  t d d ƒ t d d ƒ t d d ƒ ƒ |  j d t d d ƒ t d d ƒ ƒ |  j d t d d ƒ t d ƒ ƒ |  j  t d d
 ƒ t d d
 ƒ t d
 d ƒ ƒ |  j  t d d ƒ t d d
 ƒ t d
 ƒ ƒ |  j  t d d ƒ t d d
 ƒ t d ƒ ƒ |  j d t d ƒ t d d ƒ ƒ |  j  t d d ƒ t d d ƒ 
ƒ |  j t t t d ƒ t d d ƒ ƒ d  S(   Ni   i   i
   i   iýÿÿÿi   i   i	   i   i   iùÿÿÿi   i   g       @iÿÿÿÿl      m+?ÐR l      m+?ÐR (   R6   R   R@   RK   RU   t   pow(   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testArithmeticJ  s    ////&#/,,##c         C   sZ  |  j  t d d ƒ t d d ƒ d ƒ |  j  d t d d ƒ d ƒ |  j  d t d d ƒ d ƒ |  j  t d d ƒ d t d d ƒ ƒ |  j  d d t d d ƒ ƒ |  j  d d t d d ƒ ƒ |  j  t d d ƒ t d d ƒ d ƒ |  j  d t d d ƒ d ƒ |  j  d t d d ƒ d ƒ |  j  t d	 d ƒ d t d d ƒ ƒ |  j  d
 d t d d ƒ ƒ |  j  d d t d d ƒ ƒ |  j  t d d ƒ t d d ƒ d ƒ |  j  d t d d ƒ d ƒ |  j  d  t d d ƒ d! ƒ |  j  t d d ƒ d t d d ƒ ƒ |  j  d d t d d ƒ ƒ |  j  d" d# t d d ƒ ƒ |  j  t d d ƒ t d d ƒ d ƒ |  j  d t d d ƒ d ƒ |  j  d$ t d d ƒ d% ƒ |  j  t d d ƒ d t d d ƒ ƒ |  j  d d t d d ƒ ƒ |  j  d& d' t d d ƒ ƒ |  j  d t d d ƒ d ƒ |  j  d t d d ƒ d ƒ |  j  d d t d d ƒ ƒ |  j  d( d) t d d ƒ ƒ |  j  d d t d d ƒ ƒ |  j  t d d ƒ t d d ƒ d ƒ |  j  d t d d ƒ d ƒ |  j  t d d ƒ d t d d ƒ ƒ |  j  d d t d d ƒ ƒ |  j  t d d ƒ t d d ƒ d ƒ |  j  t d d ƒ t d d ƒ d ƒ |  j  d t d d ƒ d ƒ |  j  d* t d d ƒ d+ ƒ |  j  d d t d d ƒ ƒ |  j t t d t d d ƒ ƒ |  j  t d d ƒ d t d d ƒ ƒ |  j  d d t d d ƒ ƒ |  j  d d t d d ƒ ƒ |  j  d, d- t d d ƒ ƒ d  S(.   Ni   i
   i   gš™™™™™ñ?g      ð?y                i÷ÿÿÿgÍÌÌÌÌÌì¿i	   gÍÌÌÌÌÌì?gš™™™™™¹?g      $@i    g        i   i   id   iþÿÿÿi   i   iÿÿÿÿg       @g      Ð?yš™™™™™ñ?        y      ð?        yš™™™™™ñ?        y      ð?        yÍÌÌÌÌÌì¿        y      ð?        yÍÌÌÌÌÌì?        y      ð?        yš™™™™™¹?        y      ð?        yš™™™™™¹?        y      ð?        yš™™™™™¹?        y      ð?        y      $@        y      ð?        l      m+?ÐR l     €dê&Oá!yš™™™™™¹?        y      ð?        y      ð?        y      ð?        (   R@   R   RK   RU   Rt   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testMixedArithmeticY  sV    &&&&&&&&&&&&&c         C   sy   |  j  t d t j t d d ƒ t d ƒ ƒ |  j  t d t j t d ƒ t d d ƒ ƒ |  j t d d ƒ t d ƒ ƒ d  S(	   Ns;   unsupported operand type(s) for +: 'Fraction' and 'Decimal'i   i   s	   3.1415926s;   unsupported operand type(s) for +: 'Decimal' and 'Fraction'i   i   s   2.5(   RI   R   R   t   addR   R    RY   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testMixingWithDecimal�  s    c         C   sQ  |  j  t d d ƒ t d d ƒ k  ƒ |  j t d d ƒ t d d ƒ k  ƒ |  j  t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k ƒ |  j t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k ƒ |  j t d d ƒ t d d ƒ k ƒ |  j t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k ƒ d  S(   Ni   i   i   (   t
   assertTrueR   t   assertFalse(   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testComparisonsœ  s    %%%%%%%%c         C   s  |  j  t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k ƒ |  j t d d ƒ t d d ƒ k ƒ |  j t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k  ƒ |  j t d d ƒ t d d ƒ k  ƒ |  j t d d ƒ t d d ƒ k  ƒ |  j t d d ƒ t d d ƒ k ƒ |  j t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k ƒ |  j t d d ƒ t d d ƒ k ƒ |  j t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k  ƒ |  j t d d ƒ t d d ƒ k  ƒ |  j t d d ƒ t d d ƒ k  ƒ |  j t d d ƒ t d d ƒ k ƒ |  j t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k ƒ |  j t d d ƒ t d d ƒ k ƒ |  j t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d d ƒ k ƒ d  S(   Ni   i   i   i   i   (   Ry   R   R+   Rz   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testComparisonsDummyRational§  s8    %%%%%%%%%%%%%%%%%%%%%%%%%%%c         C   së   t  d d ƒ } t d d ƒ } |  j | | k ƒ |  j | | k  pM | | k ƒ |  j | | k ƒ |  j | | k o | | k ƒ |  j | | k ƒ |  j | | k  p± | | k ƒ |  j | | k ƒ |  j | | k oã | | k ƒ d  S(   Ng      ð?g      @i   i   (   R   R   Ry   Rz   (   R   t   xt   y(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testComparisonsDummyFloatÇ  s    c         C   s°  |  j  d t d d ƒ k  ƒ |  j d t d d ƒ k  ƒ |  j  t d d ƒ d k  ƒ |  j t d d ƒ d k  ƒ |  j  t d d ƒ d k  ƒ |  j t d d ƒ d k  ƒ |  j  d t d d ƒ k  ƒ |  j d t d d ƒ k  ƒ |  j t d	 ƒ t d d ƒ k  ƒ |  j  t d
 ƒ t d d ƒ k  ƒ |  j t d ƒ t d d ƒ k  ƒ |  j  t d d ƒ t d	 ƒ k  ƒ |  j t d d ƒ t d
 ƒ k  ƒ |  j t d d ƒ t d ƒ k  ƒ d  S(   Ni   i   i   i   i   g333333ã?gš™™™™™Ù?g      à?RN   s   -infi    i
   RM   iýÿÿÿi   i   i   i�   i§ÿÿÿ(   Ry   R   Rz   R
   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testMixedLessÓ  s    """""c         C   s°  |  j  d t d d ƒ k ƒ |  j d t d d ƒ k ƒ |  j  t d d ƒ d k ƒ |  j t d d ƒ d k ƒ |  j  d t d d ƒ k ƒ |  j d t d d ƒ k ƒ |  j  t d d ƒ d k ƒ |  j t d d ƒ d k ƒ |  j t d	 ƒ t d d ƒ k ƒ |  j  t d
 ƒ t d d ƒ k ƒ |  j t d ƒ t d d ƒ k ƒ |  j  t d d ƒ t d	 ƒ k ƒ |  j t d d ƒ t d
 ƒ k ƒ |  j t d d ƒ t d ƒ k ƒ d  S(   Ng      à?i   i   g333333ã?gš™™™™™Ù?i   i   i   RN   s   -infi    i
   RM   iýÿÿÿi   i   i   i�   i§ÿÿÿ(   Ry   R   Rz   R
   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testMixedLessEqualå  s    """""c         C   sç   |  j  t d ƒ t d ƒ k ƒ |  j  d t t t j d ƒ d ƒ ƒ k  ƒ |  j d t t j d ƒ d ƒ k  ƒ |  j  d t t j d ƒ d ƒ k ƒ |  j d t t j d ƒ d ƒ k ƒ |  j  d t t j d ƒ d ƒ k ƒ d  S(   Ni
   i   göJáÇ-µDi   l      m+?ÐR l      m+?ÐR (   Rz   R   R
   Ri   Rj   Ry   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testBigFloatComparisonsö  s    ,&&&c         C   sg  |  j  t d ƒ t d	 ƒ k ƒ |  j t t j t d
 ƒ t d ƒ ƒ |  j t t j t d ƒ t d ƒ ƒ t d d ƒ } t d d ƒ } t d d ƒ } |  j | | k ƒ |  j  | | k ƒ |  j  | | k ƒ |  j | | k ƒ x~ t j	 t j t j t j
 f D]^ } |  j t | | | ƒ |  j t | | | ƒ |  j t | | | ƒ |  j t | | | ƒ qWd  S(   Ni
   i   i   i   g      Ø?g        gš™™™™™É?l      m+?ÐR l      m+?ÐR l      m+?ÐR l      m+?ÐR l      m+?ÐR l      m+?ÐR (   Rz   R   Rr   RK   R   R   R!   R   Ry   R   R   (   R   R}   t   zt   wR   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testBigComplexComparisons   s    %%%c         C   sl  |  j  d t d d ƒ k ƒ |  j d t d d ƒ k ƒ |  j  t d d ƒ d k ƒ |  j t d d ƒ d k ƒ |  j  d t d d ƒ k ƒ |  j d t d d ƒ k ƒ |  j  t d d ƒ d k ƒ |  j t d d ƒ d k ƒ |  j t d d ƒ t d	 ƒ k ƒ |  j t d	 ƒ t d d
 ƒ k ƒ |  j t d d ƒ t d ƒ k ƒ |  j t d ƒ t d d ƒ k ƒ d  S(   Ng      à?i   i   g333333ã?gš™™™™™Ù?i   i   i   RM   i   RN   s   -inf(   Ry   R   Rz   R
   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testMixedEqual  s    """c         C   sœ   |  j  d t t d d ƒ ƒ ƒ |  j  d t t d ƒ ƒ ƒ |  j  d t t d d ƒ ƒ ƒ |  j  d
 t t d d ƒ ƒ ƒ |  j  d t t d d ƒ ƒ ƒ d  S(   Ns   Fraction(7, 3)i   i   s    Fraction(6283185307, 2000000000)s   3.1415926535s#   Fraction(-1, 100000000000000000000)i   i
   i   s   7/3Rf   l      Fµx:^V lûÿÿÿ   Fµx:^V (   R6   t   reprR   RA   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testStringification   s    		c         C   ss   |  j  t d ƒ t t d d ƒ ƒ ƒ |  j  t d ƒ t t d ƒ ƒ ƒ |  j t t d	 ƒ ƒ t t d
 ƒ ƒ ƒ d  S(   Ng      @i   i   i
   i2   i   l          +ÛO¦ ±tC3’y+v° l          +ÛO¦ ±tC3’y+v° l      m+?ÐR l      m+?ÐR (   R6   t   hashR   RY   R
   (   R   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testHash)  s    %"c   	      C   sÁ   t  d ƒ } d | d d d d d f \ } } } } } } } xk t | | ƒ t  d d	 ƒ k r© | } | | | d } } | | | d } } | | | } | | 7} q? W|  j t j | ƒ d  S(
   Ni   i    i   i   i
   i	   i   i    i Êš;(   R   t   absRq   Ri   t   pi(	   R   t   threet   lastst   tt   st   nt   nat   dt   da(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testApproximatePi.  s    0"c         C   sË   t  d ƒ } d d t  d ƒ d d d f \ } } } } } } xo t | | ƒ t  d d ƒ k r­ | } | d 7} | | | d 9} | | | 9} | d 9} | | | | 7} q? W|  j t j d ƒ | ƒ d  S(   Ni   i    i
   i	   i   iÿÿÿÿi Êš;(   R   R‹   Rq   Ri   t   cos(   R   R}   Rc   RŽ   R�   t   factR-   t   sign(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   testApproximateCos1;  s    0"

c         C   sò   t  d d ƒ } t d d ƒ } |  j | t t | ƒ ƒ ƒ |  j t | ƒ t t | ƒ ƒ ƒ |  j t | ƒ t t | ƒ ƒ ƒ |  j t | ƒ t t | ƒ ƒ ƒ |  j t | ƒ t t | ƒ ƒ ƒ |  j	 | t | ƒ ƒ |  j	 | t | ƒ ƒ d  S(   Ni   i   (
   R   R4   R6   R   R   t   idR   R   RY   R@   (   R   R:   t   dr(    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   test_copy_deepcopy_pickleI  s    """"c         C   s,   t  d d ƒ } |  j t t | d d ƒ d  S(   Ni   i   t   ai
   (   R   RK   RW   RX   (   R   R:   (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt
   test_slotsT  s    (   R%   R&   R@   RI   RL   t   requires_IEEE_754RO   RQ   RV   RZ   R\   R`   Rd   Rs   Ru   Rv   Rx   R{   R|   R   R€   R�   R‚   R…   R†   Rˆ   RŠ   R•   R™   Rœ   Rž   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyR<   r   s8   		
	
		8							7			 				
								c           C   s   t  t t ƒ d  S(   N(   R   R<   R5   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt	   test_mainY  s    t   __main__("   R'   t   decimalR    t   test.test_supportR   Ri   R   R   R0   t   syst   unittestR   R   t   cPickleR   R   R1   R   R,   t
   skipUnlessR
   t   __getformat__t
   startswithRŸ   t   objectR   R+   R4   t   TestCaseR5   R;   R<   R    R%   (    (    (    s‰   /home/sim/yocto/scarthgap/build/tmp/work/x86_64-linux/python-native/2.7.18/recipe-sysroot-native/usr/lib/python2.7/test/test_fractions.pyt   <module>   s2   			#$	ÿ è	