U
    ƽb
                     @   s<   d dl mZ d dlZd dlZd dlmZ G dd deZdS )    )TestCaseN)StringIOc                   @   s$   e Zd Zdd Zdd Zdd ZdS )
TestIndentc              
   C   s   dgdgg dddddidd	d
g}t d}t|}tj|dddd}tj|dddd}tj|dddd}t|}t|}t|}	t|}
| || | || | |	| | |
| | ||dd | ||dd | || d S )NZblorpieZwhoopsz	d-shtaeouz	d-nthiouhzi-vhbjkhnthZniftyW   yesF)fieldZ	morefielda3          [
        	[
        		"blorpie"
        	],
        	[
        		"whoops"
        	],
        	[],
        	"d-shtaeou",
        	"d-nthiouh",
        	"i-vhbjkhnth",
        	{
        		"nifty": 87
        	},
        	{
        		"field": "yes",
        		"morefield": false
        	}
        ]	T,: )indent	sort_keys
separatorsz     )textwrapdedentjsondumpsloadsassertEqualreplace)selfhexpectd1Zd2Zd3Zd4h1h2h3h4 r   @/tmp/pip-unpacked-wheel-9yxrzpkm/simplejson/tests/test_indent.pytest_indent   s*     





zTestIndent.test_indentc                    s.   ddi  fdd}|dd |d d d S )N      c                    sD   t j | d}|| t }t j || d | | d S )Nr   )r   r   r   r   dumpgetvalue)r   expectedr   sior   r   r   r    check:   s
    z&TestIndent.test_indent0.<locals>.checkr   z
{
"3": 1
}z{"3": 1}r   )r   r*   r   r)   r    test_indent08   s    	
zTestIndent.test_indent0c                 C   s^   ddddg}d}d}|  |tj|ddd	 |  |tj|dd
d	 |  |tj|dd d S )Nr#   r   r"      z[
1,
2,
3,
4
]z[
1, 
2, 
3, 
4
]r   )z, r   )r   r   r	   r$   )r   r   r   )r   lstr   Zexpect_spacesr   r   r    test_separatorsG   s    zTestIndent.test_separatorsN)__name__
__module____qualname__r!   r+   r.   r   r   r   r    r      s   0r   )Zunittestr   r   Z
simplejsonr   Zsimplejson.compatr   r   r   r   r   r    <module>   s   