
    daf                         d dl Z d dl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
mZ ddlmZ  G d de	j                        Zy)	    N)Decimal)Path)support   )tomllibc                   0    e Zd Zd Zd Zd Zd Zd Zd Zy)TestMiscellaneousc                 4   d}ddg d}t        j                         5 }t        |      dz  }|j                  |       t	        |d      5 }t        j                  |      }d d d        d d d        | j                  |       y # 1 sw Y   $xY w# 1 sw Y   (xY w)Nzone=1 
 two='two' 
 arr=[]r   two)oner   arr	test.tomlrb)tempfileTemporaryDirectoryr   
write_textopenr   loadassertEqual)selfcontentexpectedtmp_dir_path	file_pathbin_factuals          6/root/Python-3.12.4/Lib/test/test_tomllib/test_misc.py	test_loadzTestMiscellaneous.test_load   s    0U26((* 	-l\*[8I  )i& -% e,-		- 	*- -		- 	-s#   ,B	BBB	BBc                 X   d}t        j                         5 }t        |      dz  }|j                  |       t	        |d      5 }| j                  t              5  t        j                  |       d d d        d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   xY w# 1 sw Y   y xY w)Nzone=1r   r)	r   r   r   r   r   assertRaises	TypeErrorr   r   )r   r   r   r   txt_fs        r   test_incorrect_loadz%TestMiscellaneous.test_incorrect_load   s    ((* 	(l\*[8I  )i% (&&y1 (LL'((		( 	(
( (( (		( 	(s;   ,B BB/B7B BBB	B  B)c           	         d}t        j                  |t              }t        d      t        d      t        d      t        d      t        d      t        d      t        d      d}|j                         D ]b  \  }}||   }| j	                  |t               |j                         r | j                  |j                                Q| j                  ||       d y )	Nz
              val=0.1
              biggest1=inf
              biggest2=+inf
              smallest=-inf
              notnum1=nan
              notnum2=-nan
              notnum3=+nan
              )parse_floatz0.1infz-infnanz-nan)valbiggest1biggest2smallestnotnum1notnum2notnum3)r   loadsDitemsassertIsInstanceis_nan
assertTruer   )r   docobjr   kexpected_val
actual_vals          r   test_parse_floatz"TestMiscellaneous.test_parse_float'   s     mmCQ/U8%%&	xyx
  (~~/ 	;OA|QJ!!*a0  " 3 3 56  \:	;    c                 :   d}t        j                  |      }t        j                  |      }| j	                  ||       dddt        j
                  ddddd	dd
t        j                  t        j                  d                  giii}| j	                  ||       y )Nzj
              [bliibaa.diibaa]
              offsettime=[1979-05-27T00:32:00.999999-07:00]
              bliibaadiibaa
offsettimei        r       i?B i)hours)tzinfo)r   r0   copydeepcopyr   datetimetimezone	timedelta)r   r6   r7   obj_copyexpected_objs        r   test_deepcopyzTestMiscellaneous.test_deepcopyC   s     mmC ==%3'  )) "#+#4#4X5G5Gb5Q#R	#
$ 	<0r<   c                 N   t        j                  d      5  t        j                         }|dz  dz
  }| j                  t	        j
                         ||      5  d|dz  z   |dz  z   }t        j                  |       d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)Nd   	max_depth   limit	available
nest_countzarr = []r   infinite_recursionget_recursion_availablesubTestsysgetrecursionlimitr   r0   )r   rU   rV   recursive_array_tomls       r   !test_inline_array_recursion_limitz3TestMiscellaneous.test_inline_array_recursion_limit_   s    ''#6 	4779I#q.A-JC$9$9$;(1)3  5 4 (0*s2B'BZRUEU'U$23	4		4 	44 4		4 	4s$   AB$B>BB	BB$c                 H   t        j                  d      5  t        j                         }|dz  dz
  }| j                  t	        j
                         ||      5  |dz  |dz  z   }t        j                  |       d d d        d d d        y # 1 sw Y   xY w# 1 sw Y   y xY w)NrO   rP      r   rS   zkey = {}rY   )r   rU   rV   recursive_table_tomls       r   !test_inline_table_recursion_limitz3TestMiscellaneous.test_inline_table_recursion_limitj   s    ''#6 	4779I#q.A-JC$9$9$;(1)3  5 4 (2I'=
S@P'P$23	4		4 	44 4		4 	4s$   AB!B;BB	BB!N)	__name__
__module____qualname__r   r$   r;   rM   r`   re    r<   r   r	   r	      s     	+(;818	4	4r<   r	   )rF   rH   decimalr   r1   pathlibr   r]   r   unittesttestr    r   TestCaser	   ri   r<   r   <module>rp      s6   
      
    b4)) b4r<   