3
d                 @   sT   d dl Z d dlmZ d dlmZmZ d dlZd dlm	Z	m
Z
mZ G dd deZdS )    N)TestCase)	long_type	text_type)NaNPosInfNegInfc               @   s4   e Zd Zdd Zdd Zdd Zdd Zd	d
 ZdS )	TestFloatc             C   sP   x(t tfD ]}| jtjtj|| q
W tjtjt}| jd| |k d S )Nr   )r   r   assertEqualjsonloadsdumpsr   Z
assertTrue)selfinfnan r   A/tmp/pip-build-7vycvbft/simplejson/simplejson/tests/test_float.pytest_degenerates_allow   s    z TestFloat.test_degenerates_allowc             C   s4   x.t ttfD ] }| jtjtj|ddd  qW d S )NT)Z
ignore_nan)r   r   r   r	   r
   r   r   )r   fr   r   r   test_degenerates_ignore   s    z!TestFloat.test_degenerates_ignorec             C   s,   x&t ttfD ]}| jttj|dd qW d S )NF)	allow_nan)r   r   r   ZassertRaises
ValueErrorr
   r   )r   r   r   r   r   test_degenerates_deny   s    zTestFloat.test_degenerates_denyc             C   st   xndt jt jd t jd dgD ]N}| jttj|| | jtjtj|| | jtjttj|| qW d S )NgAd   g@i)mathpir	   floatr
   r   r   r   )r   numr   r   r   test_floats   s
    zTestFloat.test_floatsc             C   s~   xxdt dddgD ]d}| jtj|t| | jttj|| | jtjtj|| | jtjttj|| qW d S )N       @   l        l            )r   r	   r
   r   strintr   r   )r   r   r   r   r   	test_ints   s
    zTestFloat.test_intsN)__name__
__module____qualname__r   r   r   r   r#   r   r   r   r   r      s
   r   )r   Zunittestr   Zsimplejson.compatr   r   Z
simplejsonr
   Zsimplejson.decoderr   r   r   r   r   r   r   r   <module>   s
   