ó
‹wÛjc           @   sŸ   d  Z  d d l m Z m Z d d l Z e d d e ƒZ e j e j e j	 Z Z Z	 e
 d ƒ Z d e j f d „  ƒ  YZ d	 „  Z e d
 k r› e ƒ  n  d S(   s0   
   Tests for fpformat module
   Nick Mathewson
iÿÿÿÿ(   t   run_unittestt   import_moduleNt   fpformatt
   deprecatedt    t   FpformatTestc           B   s>   e  Z d  „  Z d „  Z d „  Z d „  Z d „  Z d „  Z RS(   c         C   sW   t  | | ƒ } t | t ƒ r- t | ƒ } n  d | t | ƒ f } |  j | | ƒ d  S(   Ns   %.*f(   t   fixt
   isinstancet
   StringTypet   reprt   floatt   assertEqual(   t   selft   nt   digitst   resultt   expected(    (    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_fpformat.pyt   checkFix   s
    c         C   s§   t  | | ƒ } t | t ƒ r- t | ƒ } n  d | t | ƒ f } | j d ƒ \ } } t | ƒ d k  rƒ | d d | d } n  d | | f } |  j | | ƒ d  S(   Ns   %.*et   ei   i    t   0i   s   %se%s(   t   sciR   R   R	   R
   t   splitt   lenR   (   R   R   R   R   R   t   numt   exp(    (    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_fpformat.pyt   checkSci   s    c         C   s>   |  j  t d d d ƒ d ƒ |  j  t d d d ƒ d ƒ d  S(   Ng      Y@i   s   33.333s
   3.333e+001(   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_fpformat.pyt   test_basic_cases,   s    c         C   sŒ   x… t  d ƒ D]w } xn d d d d d d d d f D]L } xC | d | | d | f D]& } |  j | | ƒ |  j | | ƒ qV Wq4 Wq Wd  S(	   Ni   g     @�@i   iè  gü©ñÒMb`?g      ð?g    _ Bg      ð¿(   t   rangeR   R   (   R   t   dt   valt   realVal(    (    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_fpformat.pyt   test_reasonable_values0   s
    '"c         C   s—   |  j  t d d ƒ d d d ƒ |  j  t d d d d ƒ d ƒ d } |  j  t | d	 ƒ | ƒ y t | d	 ƒ Wn t k
 r… n X|  j d
 ƒ d  S(   Ng      ð?iè  s   1.R   t   1i    s   1e+1000s   Throatwobbler Mangrovei
   s   No exception on non-numeric sci(   R   R   R   t
   NotANumbert   fail(   R   t   yacht(    (    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_fpformat.pyt   test_failing_values7   s    !!c         C   s^   d d d d } d } |  j  t j | | ƒ | ƒ |  j t ƒ � t j | | ƒ Wd  QXd  S(   Ns   +0R   i@B s   ++i   (   R   R   R   t   assertRaisesR!   R   (   R   t   attackt   digs(    (    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_fpformat.pyt
   test_REDOSF   s
    (   t   __name__t
   __module__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_fpformat.pyR      s   					c           C   s   t  t ƒ 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_fpformat.pyt	   test_mainQ   s    t   __main__(   t   __doc__t   test.test_supportR    R   t   unittestt   TrueR   R   R   R!   t   typeR   t   TestCaseR   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_fpformat.pyt   <module>   s   <	