관리-도구
편집 파일: test_decode.cpython-37.pyc
B VX�Y� � @ sT d dl mZ d dlZd dlmZ d dlZd dlmZ d dlm Z G dd� de�Z dS )� )�absolute_importN)�TestCase)�StringIO)�OrderedDictc @ sv e Zd Zeed�sdd� Zdd� Zdd� Zdd � Zd d� Z dd � Z dd� Zdd� Zdd� Z dd� Zdd� Zdd� ZdS )� TestDecode�assertIsc C s | � ||kd||f � d S )Nz%r is %r)� assertTrue)�self�a�b� r �O/opt/alt/python37/lib64/python3.7/site-packages/simplejson/tests/test_decode.pyr s zTestDecode.assertIsc C s8 t jdtjd�}| �t|tj�� | �|t�d�� d S )Nz1.1)�parse_float)�json�loads�decimalZDecimalr � isinstance�assertEqual)r �rvalr r r �test_decimal s zTestDecode.test_decimalc C s. t jdtd�}| �t|t�� | �|d� d S )N�1)� parse_intg �?)r r �floatr r r )r r r r r � test_float s zTestDecode.test_floatc C s t �d�}| �|ddd�� d S )Nz,{ "key" : "value" , "k":"v" }�value�v)�key�k)r r r )r r r r r �test_decoder_optimizations s z%TestDecode.test_decoder_optimizationsc C sR d}| � t�|�t|�� d}| � t�|�t|�� d}| � t�|�t|�� d S )Nz{}z[]z"")r r r �eval)r �sr r r �test_empty_objects s zTestDecode.test_empty_objectsc C s� d}dddddddg}| � t�|�t|�� | � tj|d d � d�|� | � tjt|�dd � d�|� tj|td�}| � |t|�� | � t|�t� | � tj|td d � d�t|�� d S )Nz?{"xkd":1, "kcw":2, "art":3, "hxm":4, "qrt":5, "pad":6, "hoy":7})Zxkd� )Zkcw� )Zart� )Zhxm� )Zqrt� )�pad� )Zhoy� c S s | S )Nr )�xr r r �<lambda>, � z3TestDecode.test_object_pairs_hook.<locals>.<lambda>)�object_pairs_hookc S s | S )Nr )r* r r r r+ . r, c S s d S )Nr )r* r r r r+ 5 r, )r- �object_hook)r r r r �loadr r �type)r r �pZodr r r �test_object_pairs_hook'