+
    Bi                       ^ RI t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIt^ RIt^ RI	t	^ RI
Ht ^ RIHtHtHt ^ RIHt ^ RIHt ^ RIHt ^ R	IHt  ! R
 R4      t ! R R]P2                  4      t ! R R]P2                  4      t ! R R]P2                  4      t ! R R]4      t ! R R]P<                  4      t ! R R]4      t  ! R R]4      t! ! R R]P<                  4      t" ! R R]4      t# ! R R]P2                  4      t$ ! R  R!]P2                  4      t% ! R" R#]P2                  4      t& ! R$ R%]P2                  4      t' ! R& R'4      t(]PR                  ! ]*! ]R(4      R)4       ! R* R+]P2                  4      4       t+ ! R, R-]P2                  4      t, ! R. R/]P2                  4      t- ! R0 R1]P2                  4      t.]/R28X  d   ]P`                  ! 4        R# R# )3    N)StringIO)TemporaryFile)support)cpython_onlyimport_helpercheck_disallow_instantiationensure_lazy_imports)permutations)dedent)OrderedDictc                   &   a  ] tR t^t o R tRtV tR# )BadIterablec                    \         hNOSErrorselfs   &$/usr/lib/python3.14/test/test_csv.py__iter__BadIterable.__iter__   s         N)__name__
__module____qualname____firstlineno__r   __static_attributes____classdictcell____classdict__s   @r   r   r      s      r   r   c                   
  a  ] tR t^t o R tR tR tR tR tR t	R t
R tR	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR t R t!R t"R  t#R! t$R" t%R# t&R$ t'R% t(R& t)R' t*R(t+V t,R)# )*Test_Csvc                   V! V4       V P                  \        V4       V P                  \        VR 4       V P                  \        W^ R7       V P                  \        WRR7       V P                  \        WRR7       V P                  \        WRR7       V P                  \        WRR7       V P                  \        WRR7       V P                  \        WRR7       V P                  \        P                  WR4       V P                  \        WR R7       V P                  \        W^R7       V P                  \        W^R7       V P                  \        W^R7       V P                  \        WR R7       V P                  \        W^R7       V P                  \        WR R	7       V P                  \        W\        P                  RR
7       V P                  \        W\        P                  R R
7       V P                  \        W\        P
                  RR
7       V P                  \        WRR7       V P                  \        WRR7       V P                  \        WRR7       V P                  \        WRR7       V P                  \        WRR7       V P                  \        WRR7       V! VRR7       V! VRR7       V! VRR7       V! VRRR7       V! VRRR7       V! VRRR7       V! VRRR7       V P                  \        WRRR7       V P                  \        WRRR7       V! VRR7       V! VRR7       V! VRR7       V P                  \        WRRR7       V P                  \        WRRR7       V P                  \        WRRR7       V! VRR7       V! VRR7       V! VRR7       V! VRR7       V P                  \        WRRR7       V P                  \        WRRR7       V P                  \        WRRR7       R # )N)bad_attr 	delimiter
escapechar	quotecharz^^foolineterminatorquoting)r2   r-   
 	Tr)   skipinitialspace)r+   r8   )r-   r8   ^)r)   r+   )r)   r-   )r+   r-      )r)   r0   )r+   r0   )r-   r0   )assertRaises	TypeErrorcsvError	QUOTE_ALL
QUOTE_NONE
ValueError)r   ctorargs   &&&r   _test_arg_validTest_Csv._test_arg_valid   s   S	)T*)T40)T;)T"=)T2>)T"=)T$?)T4@)T$?#))T6)T$?)T!<)T1=)T!<)TtD)TqA)T=)T"%--2 	 	?)T"%--4 	 	A)T"%..B 	 	@*d4@*dDA*d4@*d4@*dDA*d4@SC SS!SC SD48STD9SD48SC$7*d%(4 	 	A*d$'$ 	 	@SC SS!SC *d33O*d3#N*dC3OSF#SV$SF#S(*d$*6 	 	C*d%+F 	 	D*d$*6 	 	Cr   c                    V P                  \        P                  . 4       V P                  \        \        P                  \        4       4       R # r   )rD   r=   readerr;   r   r   r   s   &r   test_reader_arg_validTest_Csv.test_reader_arg_validZ   s.    SZZ,'3::{}=r   c                    V P                  \        P                  \        4       4        ! R  R4      pV P	                  \
        \        P                  V! 4       4       R# )c                   0   a  ] tR t^`t o ]R 4       tRtV tR# )1Test_Csv.test_writer_arg_valid.<locals>.BadWriterc                    \         hr   r   r   s   &r   write7Test_Csv.test_writer_arg_valid.<locals>.BadWriter.writea   s    r   r   N)r   r   r   r   propertyrN   r   r    r!   s   @r   	BadWriterrL   `   s      r   rQ   N)rD   r=   writerr   r;   r   )r   rQ   s   & r   test_writer_arg_validTest_Csv.test_writer_arg_valid^   s<    SZZ4	 	 	'3::y{;r   c                   V! V!  pV P                  VP                  P                  R 4       V P                  VP                  P                  R4       V P                  VP                  P
                  R4       V P                  VP                  P                  R4       V P                  VP                  P                  R4       V P                  VP                  P                  \        P                  4       V P                  VP                  P                  R4       V P                  VP                  P                  R4       V P                  \        \        VP                  R4       V P                  \        \         VP                  RR4       V P                  \        \        VP                  R4       V P                  \        \         VP                  RR4       R# )	,TN
"Fr)   :r2   )assertEqualdialectr)   assertIsdoublequoter+   r0   r-   r2   r=   QUOTE_MINIMALr8   strictr;   AttributeErrordelattrsetattr)r   rB   argsobjs   &&* r   _test_default_attrsTest_Csv._test_default_attrsf   sB   Dk..4ckk--t4//633V<..4,,c.?.?@ckk22E:ckk((%0.'3;;L.'3;;SQ.'3;;	J.'3;;#T	+r   c                F    V P                  \        P                  . 4       R # r   )re   r=   rG   r   s   &r   test_reader_attrsTest_Csv.test_reader_attrsx         R0r   c                V    V P                  \        P                  \        4       4       R # r   )re   r=   rR   r   r   s   &r   test_writer_attrsTest_Csv.test_writer_attrs{         XZ8r   c                   \        R RRRR\        P                  RRR7      pV! V/ VB pV P                  VP                  P
                  R 4       V P                  VP                  P                  R4       V P                  VP                  P                  R4       V P                  VP                  P                  R4       V P                  VP                  P                  R4       V P                  VP                  P                  \        P                  4       V P                  VP                  P                  R4       V P                  VP                  P                  R4       R# )rY   F\r4   *T)r)   r]   r+   r0   r-   r2   r8   r_   N)dictr=   r@   rZ   r[   r)   r\   r]   r+   r0   r-   r2   r8   r_   )r   rB   rc   kwargsrd   s   &&*  r   _test_kw_attrsTest_Csv._test_kw_attrs~   s   4%)S!nnt!# D#F#..4ckk--u5//633T:..4,,cnn=ckk22D9ckk(($/r   c                F    V P                  \        P                  . 4       R # r   )rt   r=   rG   r   s   &r   test_reader_kw_attrsTest_Csv.test_reader_kw_attrs   s    CJJ+r   c                V    V P                  \        P                  \        4       4       R # r   )rt   r=   rR   r   r   s   &r   test_writer_kw_attrsTest_Csv.test_writer_kw_attrs   s    CJJ
3r   c                    ! R  R4      pW#3,           pV! V!  pV P                  VP                  P                  R4       V P                  VP                  P                  R4       V P                  VP                  P
                  R4       V P                  VP                  P                  R4       V P                  VP                  P                  R4       V P                  VP                  P                  \        P                  4       V P                  VP                  P                  R4       V P                  VP                  P                  R4       R# )	c                   J    ] tR t^tRtRtRtRtRt]	P                  tRtRtRtR# )	-Test_Csv._test_dialect_attrs.<locals>.dialect-Fr9   $#Tr   N)r   r   r   r   r)   r]   r+   r0   r-   r=   r?   r2   r8   r_   r   r   r   r   r[   r~      s/    IKJNIMMG!Fr   r[   r   Fr9   r   r   TN)rZ   r[   r)   r\   r]   r+   r0   r-   r2   r=   r?   r8   r_   )r   rB   rc   r[   rd   s   &&*  r   _test_dialect_attrsTest_Csv._test_dialect_attrs   s    	 	 j Dk..4ckk--u5//533S9..4,,cmm<ckk22D9ckk((%0r   c                F    V P                  \        P                  . 4       R # r   )r   r=   rG   r   s   &r   test_reader_dialect_attrs"Test_Csv.test_reader_dialect_attrs   rj   r   c                V    V P                  \        P                  \        4       4       R # r   )r   r=   rR   r   r   s   &r   test_writer_dialect_attrs"Test_Csv.test_writer_dialect_attrs   rn   r   c                R   \        R RRR7      ;_uu_ 4       p\        P                  ! V3/ VB pVP                  V4       VP	                  ^ 4       V P                  VP                  4       W%P                  P                  ,           4       RRR4       R#   + '       g   i     R# ; iw+utf-8r'   encodingnewlineN)	r   r=   rR   writerowseekrZ   readr[   r0   )r   fieldsexpectrs   fileobjrR   s   &&&,  r   _write_testTest_Csv._write_test   ss    4'2>>'ZZ262FOOF#LLOW\\^#nn&C&CCE	 ?>>>s   A4BB&	c           	        \        R RRR7      ;_uu_ 4       p\        P                  ! V3/ VB pV P                  V4      ;_uu_ 4        VP	                  V4       RRR4       VP                  ^ 4       V P                  VP                  4       R4       RRR4       R#   + '       g   i     LK; i  + '       g   i     R# ; ir   )r   r=   rR   r;   r   r   rZ   r   )r   excr   rs   r   rR   s   &&&,  r   _write_error_testTest_Csv._write_error_test   s    4'2>>'ZZ262F""3''' (LLOW\\^R0 ?>'' ?>>s#   1B0B	9B0B-(B00C	c                   V P                  \        P                  R 4       V P                  \        \	        4       4        ! R R4      pV P                  \        V! 4       4        ! R R4      pV P                  \        V! 4       .4       R # )Nc                   ,   a  ] tR t^t o R tR tRtV tR# ).Test_Csv.test_write_arg_valid.<locals>.BadListc                    ^
# )
   r   r   s   &r   __len__6Test_Csv.test_write_arg_valid.<locals>.BadList.__len__   s    r   c                     V^8  d   \         hR# )   Nr   )r   is   &&r   __getitem__:Test_Csv.test_write_arg_valid.<locals>.BadList.__getitem__   s    q5!M r   r   N)r   r   r   r   r   r   r   r    r!   s   @r   BadListr      s     " "r   r   c                   &   a  ] tR t^t o R tRtV tR# ).Test_Csv.test_write_arg_valid.<locals>.BadItemc                    \         hr   r   r   s   &r   __str__6Test_Csv.test_write_arg_valid.<locals>.BadItem.__str__       r   r   N)r   r   r   r   r   r   r    r!   s   @r   BadItemr            r   r   )r   r=   r>   r   r   )r   r   r   s   &  r   test_write_arg_validTest_Csv.test_write_arg_valid   sf    syy$/w6	" 	" 	w	2	 	 	w4r   c                L    R R,          pV P                  W.V: RV: 24       R# )XP  rV   N)r   )r   	bigstrings   & r   test_write_bigfieldTest_Csv.test_write_bigfield   s(    %K	).#Y10 	1r   c                B   V P                  . R
OR4       V P                  \        P                  . R
O\        P                  R7       V P                  . R
OR\        P
                  R7       V P                  . R
OR\        P                  R7       V P                  . R
OR\        P                  R7       V P                  R^.R\        P                  R7       V P                  . ROR\        P                  R7       V P                  . ROR	\        P                  R7       R# )a	a,1,"p,q"r1   z"a",1,"p,q"z"a","1","p,q"a
bz	"a
b","1"Nz	"a","",,1z"a","",,"1"r      zp,q)r   r'   Nr   )
r   r   r=   r>   r@   r^   QUOTE_NONNUMERICr?   QUOTE_STRINGSQUOTE_NOTNULLr   s   &r   test_write_quotingTest_Csv.test_write_quoting   s    4syy-), 	 	9#&#4#4 	 	6#&#7#7 	 	9#&== 	 	2&\#&== 	 	2+#&#4#4 	 	6-#&#4#4 	 	6r   c                   V P                  . RORRR7       V P                  \        P                  . RORRR7       V P                  . RORRRR7       V P                  R.R	R\        P                  R
7       V P                  R.RR\        P                  RR7       V P                  R.RR\        P
                  R
7       V P                  . RORR\        P
                  R
7       V P                  RR .RR\        P
                  R
7       V P                  RR .RR\        P                  R
7       V P                  RR .RR\        P                  R
7       V P                  RR .RR\        P                  R
7       V P                  RR .RR\        P
                  R
7       V P                  RR .RR\        P                  R
7       V P                  . RORR\        P                  R
7       R# )r   r   rp   r*   NF)r+   r]   za,1,"p,\"q\""rX   """")r+   r2   z\")r+   r2   r]   za,1,p\,qz\\,az"\\","a"z\ z\\ ,az\,z\\\,,az,\z",\\",azC\\,6,7,"X"""r   )r   r   zp,"q")zC\67zX")r   r   r=   r>   r^   r@   r?   r   s   &r   test_write_escapeTest_Csv.test_write_escape   s   $( 	 	*syy/*.E 	 	C*;$( 	 	?#$(C4E4E 	 	G#$(C4E4E', 	 	. 	#$(CNN 	 	D$(CNN 	 	D$h$(#.. 	 	B$h$(#2C2C 	 	E$l$(#-- 	 	A%y$(#2C2C 	 	E%{$(#.. 	 	B%{$(#2C2C 	 	E02C$(#2C2C 	 	Er   c                   R
 F  pV P                  VR7      ;_uu_ 4        \        4       ;_uu_ 4       p\        P                  ! W!R7      pVP	                  RR.4       VP	                  ^^.4       VP	                  RR.4       V P                  VP                  4       RV RV RV 24       R	R	R	4       R	R	R	4       K  	  R	#   + '       g   i     L; i  + '       g   i     K  ; i)rW   r3   r4   r/   r   ba,bz1,2z"","
"N)rW   r3   r4   z!@# )subTestr   r=   rR   r   rZ   getvalue)r   r0   siorR   s   &   r   test_write_lineterminator"Test_Csv.test_write_lineterminator  s    =N^<<ZZ3 ZZKFOOS#J/OOQF+OOT4L1$$S\\^'*>*:'*>*:'00@&BC   =< >Z =<<s#   CA:C-CCCC'c                   V P                  \        . RO4      R4       V P                  \        . R	O4      R4       V P                  \        . 4      R4       V P                  \        R.4      R4       V P                  \        P                  \        R.4      \        P
                  R7       V P                  \        RR.4      R4       R# )
r   r   Nza,1,r'   ""r1   rV   r   )r   r   N)r   iterr   r=   r>   r@   r   s   &r   test_write_iterableTest_Csv.test_write_iterable  s    o.<n-v6b2&tft,syy$v,OtTl+S1r   c                    ! R  R4      p\         P                  ! V! 4       4      pV P                  \        VP                  R..4       \        RRRR7      ;_uu_ 4       p\         P                  ! V4      pV P                  \        VP                  R4       VP	                  RR.R	R
..4       VP                  ^ 4       V P                  VP                  4       R4       RRR4       R#   + '       g   i     R# ; i)c                   &   a  ] tR tRt o R tRtV tR# )+Test_Csv.test_writerows.<locals>.BrokenFilei  c                    \         hr   r   )r   bufs   &&r   rN   1Test_Csv.test_writerows.<locals>.BrokenFile.write  r   r   r   N)r   r   r   r   rN   r   r    r!   s   @r   
BrokenFiler     r   r   r   r   r   r   r'   r   Nr   cdz
a,b
c,d
)
r=   rR   r;   r   	writerowsr   r<   r   rZ   r   )r   r   rR   r   s   &   r   test_writerowsTest_Csv.test_writerows  s    	 	 JL)'6#3#3seW=4'2>>'ZZ(Fi)9)94@sCj3*56LLOW\\^-=> ?>>>s   B C))C:	c                b   \        R RRR7      ;_uu_ 4       p\        P                  ! V4      pVP                  RR.RR..4       VP	                  ^ 4       V P                  VP                  4       R4       RRR4       \        R RRR7      ;_uu_ 4       p\        P                  ! V4      pVP                  R.R..4       VP	                  ^ 4       V P                  VP                  4       R4       RRR4       \        R RRR7      ;_uu_ 4       p\        P                  ! V4      pVP                  R.R..4       VP	                  ^ 4       V P                  VP                  4       R	4       RRR4       R#   + '       g   i     EL	; i  + '       g   i     L; i  + '       g   i     R# ; i)
r   r   r'   r   r   Nr   za,
,d
z""
a
za
""
)r   r=   rR   r   r   rZ   r   r   r   rR   s   &  r   test_writerows_with_none!Test_Csv.test_writerows_with_none)  s@   4'2>>'ZZ(FsDkD#;78LLOW\\^^<	 ? 4'2>>'ZZ(Ftfse_-LLOW\\^];	 ? 4'2>>'ZZ(FsedV_-LLOW\\^];	 ?> ?>> ?> ?>>s&   AE6AF
AF6F	
F	F.	c                   V P                  RR 4       V P                  R .R4       V P                  \        P                  R .\        P                  R7       V P                  R .R\        P
                  R7       V P                  R .R\        P                  R7       V P                  R.R4       V P                  \        P                  R.\        P                  R7       V P                  \        P                  R.\        P
                  R7       V P                  \        P                  R.\        P                  R7       V P                  R R .R4       V P                  RR.R4       R# )r'   r   r1   NrV   r   )r   r   r=   r>   r@   r   r   r   s   &r   test_write_empty_fields Test_Csv.test_write_empty_fields=  s   R "t$syy2$G"tS->->?"tS->->?$&syy4&#..Isyy4&#:K:KLsyy4&#:K:KL"b3'$s+r   c           	        V P                  R .RRRR7       V P                  R .RRRR7       V P                  R.RRRR7       V P                  R.RRRR7       V P                  R R .RRRR7       V P                  R R .RRRR7       V P                  RR.RRRR7       V P                  RR.RRRR7       V P                  R R .RRR\        P                  R7       V P                  \        P                  R R .RR\        P                  R7       \        P
                  \        P                  3 F3  pV P                  R R .RRRVR7       V P                  R R .RRRVR7       K5  	  \        P                  \        P
                  \        P                  3 FA  pV P                  RR.RRRVR7       V P                  \        P                  RR.RRVR7       KC  	  R# )	r'   r   r5   Fr7   TNz"" "")r)   r8   r2   )r   r=   r@   r   r>   r   r   )r   r2   s   & r   'test_write_empty_fields_space_delimiter0Test_Csv.test_write_empty_fields_space_delimiterJ  s   "tsUK"tsTJ$uM$tL"b3#N"b7cDQ$scER$w#PTU"b3#!$ 	 	1syy2r(),t'*~~ 	 	7 ((#*;*;;Gb"Xw#PU%,  .b"Xw#PT%,  . < ~~s'8'8#:K:KKGdD\3#PU%,  .""399tTl-04+2 # 4 Lr   c                ,   \        R RRR7      ;_uu_ 4       p\        P                  ! V4      pV P                  \        VP
                  R4       V P                  \        VP
                  \        4       4       RRR4       R#   + '       g   i     R# ; ir   )r   r=   rR   r;   r<   r   r   r   r   s   &  r   test_writerows_errorsTest_Csv.test_writerows_errorsg  sb    4'2>>'ZZ(Fi)9)94@gv'7'7G ?>>>s   A!BB	c                l    \         P                  ! V3/ VB p\        V4      pV P                  WR4       R # r   )r=   rG   listrZ   )r   inputr   rs   rG   results   &&&,  r   
_read_testTest_Csv._read_testm  s,    E,V,f(r   c                8   V P                  . . 4       V P                  R .. .4       V P                  \        P                  V P                   R.R^R7       V P                  R.R..^ R7       V P                  \        P                  V P                   R.R4       R# )r'   z"ab"cNr_   abc)r]   s   abcr   r;   r=   r>   r   s   &r   test_read_oddinputsTest_Csv.test_read_oddinputsr  s    Brd##))T__")TA 	 	7	UG9A>#))T__!(D	*r   c                4   V P                  R R.RR.RR..4       V P                  RR.RR.RR..4       V P                  RR	.RR.RR..4       V P                  R
R.RR.RR..4       RpV P                  \        P                  V4      ;_uu_ 4        \	        \        P
                  ! R.4      4       RRR4       V P                  \        P                  V4      ;_uu_ 4        \	        \        P
                  ! R.4      4       RRR4       V P                  \        P                  V4      ;_uu_ 4        \	        \        P
                  ! R.4      4       RRR4       R#   + '       g   i     L; i  + '       g   i     Lv; i  + '       g   i     R# ; i)r   zc,dr   r   r   r   za,b
zc,d
za,b
zc,d
za,bzc,dzwith newline=''za,bc,dNza,b
c,dza,b
c,d)r   assertRaisesRegexr=   r>   nextrG   )r   errmsgs   & r   test_read_eolTest_Csv.test_read_eol|  s0   #cSI(>?'*c#YS	,BCI.#cSI0FG'*c#YS	,BC"##CIIv66ZL)* 7##CIIv66ZL)* 7##CIIv66\N+, 76	 7666666s$   !E $!E35!F E0	3F	F	c           	        V P                  R .RR..4       V P                  R.R..4       V P                  R.R..RR7       V P                  \        P                  V P                   R .. RR7       V P                  \        P                  V P                   R.. RR7       V P                  \        P                  V P                   R.. RRR	7       R
# )za,"r   r'   z"ar9   r3   r*   Tr   )r+   r_   Nr   r   s   &r   test_read_eofTest_Csv.test_read_eof  s    3)-#(xC8#))T__ugr$O#))T__tfbN#))T__%D 	 	Br   c                    V P                  R .R ..4       V P                  R.. RO.4       V P                  R.. R	O.4       V P                  R.. R	O.RR7       V P                  R.. RO.4       R# )
r   a, b,cza,b ,cza,b\ ,crp   r*   za," b",cN)r   z br   )r   zb r   r   r   s   &r   test_read_nulTest_Csv.test_read_nul  sj    $)&7%89&7%89(9':tL(9':;r   c                    V P                  R .. RO.4       V P                  R.. RO.RR7       V P                  R.. RO.RR7       R# )za,b,cza;b;c;r(   za b cr   Nr   r   r   r	  r   s   &r   test_read_delimiterTest_Csv.test_read_delimiter  sC    	O#45	O#4Do%6$Gr   c                   V P                  R .. RO.RR7       V P                  R.RR..RR7       V P                  R.RR..RR7       V P                  R.RR..RR7       V P                  R.RR	..RR7       V P                  R
.RR..RR7       V P                  R.. RO.RR7       V P                  R.. RO.RR7       V P                  R .. RO.RR7       V P                  R .. RO.4       R# )za,\b,cr   rp   r*   za,b\,czb,cza,"b\,c"za,"b,\c"z	a,"b,c\""zb,c"za,"b,c"\zb,c\za,^b,cr9   r  r   Nr  )r   z\br   r	  r   s   &r   test_read_escapeTest_Csv.test_read_escape  s    o%64HsEl^Ee~$Ge~$G#vDIg'7DI
_$5#Fo%64H&7%8TJ&7%89r   c                   V P                  R .. RO.4       V P                  R .. RO.RRR7       V P                  R .. RO.\        P                  RR7       V P                  R.. RO.\        P                  R7       V P                  R.. RO.\        P                  R7       V P                  R.. RO.\        P
                  R7       V P                  R.. RO.4       V P                  R.. RO.\        P                  R7       V P                  R.. RO.\        P                  R7       V P                  R.. RO.\        P
                  R7       V P                  R.R	R
..4       V P                  \        V P                   R.. .\        P                  R7       V P                  \        V P                   R.. .\        P
                  R7       V P                  R.. RO.RR7       V P                  R.. RO.RR7       V P                  R.. RO.\        P                  RR7       V P                  R.. RO.\        P
                  RR7       R# )z	1,",3,",5Nrp   )r-   r+   r2   r+   z,3,"5",7.3, 9r1   z,,"",z"a
b", 7r   z 7zabc,3z	1,@,3,@,5@r,   z	1, ,3, ,5r   z1\.5,\.5,.5z1\.5,\.5,"\.5")1z,3,5)r  rX   3rX   r  )r'      r  333333@	   )Nr  r  z7.3z 9)Nr  r  r  r  )r'   r'   r'   r'   )NNr'   N)      ?      ?r  )r  r  z.5)r   r=   r@   r   r   r   r;   rA   r   s   &r   test_read_quotingTest_Csv.test_read_quoting  sE   (9':;(A'B"&4 	 	9(A'B #4 	 	A 	),@+A # 4 4 	 	6),I+J # 1 1 	 	3),B+C # 1 1 	 	3 		$4#56	$4#5 # 4 4 	 	6	$:#; # 1 1 	 	3	$:#; # 1 1 	 	3 	'78*doo")bT"%"6"6 	 	8 	*doo")bT"%"3"3 	 	5 	(9':cJ*;)<M)O+< # 4 4 	 	G,-0@/A # 1 1d 	 	Dr   c                   V P                  R .. RO.RR7       V P                  R.. RO.RR7       V P                  R.. RO.R\        P                  R7       V P                  R.. RO.R\        P                  R7       R# )	zno space, space,  spaces,	tabTr8   z , , N)r8   r2   )zno spacespacespacesz	tabr'   r'   r'   )NNN)r   r=   r   r   r   s   &r   test_read_skipinitialspace#Test_Csv.test_read_skipinitialspace  s    9:AB)- 	 	/ 		%)- 	 	/ 		+,)-s7H7H 	 	J 		+,)-s7H7H 	 	Jr   c                    V P                  . R	O. R
O. RO. RO. .RRR7       V P                  . R	ORR.RR.R.. .RRR7       R# )a   br'   r   r   r5   Fr7   TN)r)  z  a  z  r'   )r   r'   r'   r   )r'   r'   r   r'   r'   r%  r	  r   s   &r   test_read_space_delimiter"Test_Csv.test_read_space_delimiter  sZ    4+-BLRTU"% 	 	? 	4sc2Yb9"% 	 	>r   c                   \         P                  ! 4       p R pRV,          pV: RV: 2pV P                  V.W3..4       \         P                  ! V4       V P                  V.W3..4       V P                  \         P                  ! 4       V4       \         P                  ! V^,
          4       V P	                  \         P
                  V P                  V.. 4       V P	                  \        \         P                  R4       V P	                  \        \         P                  ^R4       \         P                  ! V4       R#   \         P                  ! T4       i ; i)r   r   rV   N)r=   field_size_limitr   rZ   r;   r>   r<   )r   limitsizer   biglines   &    r   test_read_bigfieldTest_Csv.test_read_bigfield  s    $$&	(Dd
I!*I6GOOWI(>'?@  &OOWI(>'?@S113T:  a(cii7)RHi)=)=tDi)=)=q$G  'C  's   DD= =Ec                   \         P                  ! . RO4      pV P                  VP                  ^ 4       \	        V4       V P                  VP                  ^4       \	        V4       V P                  VP                  ^4       \	        V4       V P                  VP                  ^4       V P                  \        \        V4       V P                  VP                  ^4       R# )line,1N)r4  zline,2zline,3)r=   rG   rZ   line_numr   r;   StopIteration)r   rs   & r   test_read_linenumTest_Csv.test_read_linenum  s    JJ56Q'QQ'QQ'QQ'-q1Q'r   c                   . RO. RO. R	O. R
O. RO. RO.pR F  pV P                  VR7      ;_uu_ 4        \        RRRR7      ;_uu_ 4       p\        P                  ! W2R7      pVP	                  V4       VP                  ^ 4       \        \        P                  ! V4      4       F  w  rVV P                  WaV,          4       K  	  RRR4       RRR4       K  	  R#   + '       g   i     L; i  + '       g   i     K  ; i)
ar/   r   r   r'   r   Nr;  zb
czd
zezfgzhz
izj
kzl
z
mzn
ozp
zqzrsztz

uzv

wzx

rW   r3   r4   )	r   r   r=   rR   r   r   	enumeraterG   rZ   r   rowsr0   r   rR   r   rows   &      r   test_roundtrip_quoteed_newlines(Test_Csv.test_roundtrip_quoteed_newlines  s    ""((((
 1N^<<"4'2FF' ZZOF$$T*LLO"+CJJw,?"@((1g6 #A	 G =< 1FF =<<s$   C.A:CC.C+&C..C?c                H   . R
O. RO. RO. RO. RO. RO.pR F  pV P                  VR7      ;_uu_ 4        \        RRRR7      ;_uu_ 4       p\        P                  ! W2\        P                  RR7      pVP                  V4       VP                  ^ 4       \        \        P                  ! V\        P                  RR7      4       F  w  rVV P                  WaV,          4       K  	  R	R	R	4       R	R	R	4       K  	  R	#   + '       g   i     L; i  + '       g   i     EK
  ; i)r;  r/   r   r   r'   r   rp   )r0   r2   r+   r  Nr<  r=  r>  r?  r@  rA  rB  )
r   r   r=   rR   r@   r   r   rC  rG   rZ   rD  s   &      r   (test_roundtrip_escaped_unquoted_newlines1Test_Csv.test_roundtrip_escaped_unquoted_newlines  s    ""((((
 1N^<<"4'2FF' ZZ034QF$$T*LLO"+CJJw?B~~BF-H #I ((1g6#I G =< 1FF =<<s$   DBC<&D<DDD!r   N)-r   r   r   r   rD   rH   rS   re   rh   rl   rt   rw   rz   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r   r  r  r
  r  r  r  r&  r*  r1  r8  rG  rJ  r   r    r!   s   @r   r$   r$      s     9Cv><+$190 ,41,19E1516"E>C2?<(,4:H)
*-B<H

:"DHJ>(&
(7$7 7r   r$   c                   \   a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tRtV tR# )TestDialectRegistryi,  c                "   V P                  \        \        P                  R 4       V P                  \        \        P                  4       V P                  \        P
                  \        P                  R 4       V P                  \        P
                  \        P                  R4       V P                  \        \        P                  4       V P                  \        P
                  \        P                  R 4       V P                  \        P
                  \        P                  R4       V P                  \        \        P                  R 4       V P                  \        \        P                  R R 4       V P                  \        \        P                  R^ ^ 4       V P                  \        \        P                  RR R7       V P                  \        \        P                  RR R7       V P                  \        \        P                  . 4       R # )Nnonesuch)badargumentr1   )r;   r<   r=   list_dialectsget_dialectr>   unregister_dialectregister_dialectr   s   &r   test_registry_badargs)TestDialectRegistry.test_registry_badargs-  sZ   )S%6%6=)S__5#))S__d;#))S__jA)S%;%;<#))S%;%;TB#))S%;%;ZH)S%9%94@)S%9%94F)S%9%9:q!L)S%9%9:&* 	 	,)S%9%9:"& 	 	()S%9%92>r   c                    ! R  R\         P                  4      pRp\         P                  ! 4       V.,           pVP                  4        \         P                  ! W!4       V P                  \         P                  V4       V P                  \         P                  ! V4      P                  R4       \        \         P                  ! 4       4      pV P                  W44       R# )c                       ] tR tRtRtRtR# )5TestDialectRegistry.test_registry.<locals>.myexceltsvi?  r6   r   Nr   r   r   r   r)   r   r   r   r   
myexceltsvrY  ?      Ir   r[  r6   N)r=   excelrQ  sortrT  
addCleanuprS  rZ   rR  r)   sorted)r   r[  nameexpected_dialectsgot_dialectss   &    r   test_registry!TestDialectRegistry.test_registry>  s    	 	--/4&8 T...5.88$?c//12*9r   c           	     B   R p\         P                  ! VRR7       V P                  \         P                  V4       V P	                  \         P
                  ! V4      P                  R4       V P	                  . RO.\        \         P                  ! R.V4      4      4       R# )fedcbar  r(   zX;Y;ZN)r   YZ)	r=   rT  r_  rS  rZ   rR  r)   r   rG   )r   ra  s   & r   test_register_kwargs(TestDialectRegistry.test_register_kwargsJ  so    TS1..5.88#>/*DWIt1L,MNr   c                j    ! R  R\         P                  4      pRp\         P                  ! W!RRRRR\         P                  R7       V P	                  \         P
                  V4       \         P                  ! V4      pV P                  VP                  R4       V P                  VP                  R4       V P                  VP                  R4       V P                  VP                  R4       V P                  VP                  R4       V P                  VP                  \         P                  4       R	# )
c                   B    ] tR tRtRtRtRtRtRt]	P                  tRtR# )	DTestDialectRegistry.test_register_kwargs_override.<locals>.mydialectiR  r6   rX   TFrW   r   N)r   r   r   r   r)   r-   r]   r8   r0   r=   r^   r2   r   r   r   r   	mydialectrn  R  s'    IIK$#N''Gr   ro  test_dialectr  'FTr3   )r)   r-   r]   r8   r0   r2   N)r=   DialectrT  r?   r_  rS  rR  rZ   r)   r-   r]   r8   r0   r2   )r   ro  ra  r[   s   &   r   test_register_kwargs_override1TestDialectRegistry.test_register_kwargs_overrideQ  s    	( 	( T'*'*)..2,0%(]]	4 	..5 //$'**C0**C0,,e41148//6#--8r   c                x     ! R  R\         P                  4      pV P                  \         P                  V4       R# )c                       ] tR tRtRtRtR# )?TestDialectRegistry.test_incomplete_dialect.<locals>.myexceltsvin  r6   r   NrZ  r   r   r   r[  rw  n  r\  r   r[  N)r=   rr  r;   r>   )r   r[  s   & r   test_incomplete_dialect+TestDialectRegistry.test_incomplete_dialectm  s&    	 	#))Z0r   c                    ! R  R\         P                  4      p\        RRR7      ;_uu_ 4       pVP                  R4       VP	                  ^ 4       \         P
                  ! W!! 4       R7      pV P                  \        V4      . R
O4       V P                  \        V4      RR.4       R	R	R	4       R	#   + '       g   i     R	# ; i)c                   6    ] tR tRtRt]P                  tRtRt	R# )5TestDialectRegistry.test_space_dialect.<locals>.spaceis  r5   rp   r   N)
r   r   r   r   r)   r=   r@   r2   r+   r   r   r   r   r#  r|  s  s    InnGJr   r#  r   r   r   zabc   def
c1ccccc1 benzene
r[   c1ccccc1benzeneN)r   r'   r'   def)r=   r]  r   rN   r   rG   rZ   r   )r   r#  r   rG   s   &   r   test_space_dialect&TestDialectRegistry.test_space_dialectr  s    	CII 	
 4'22gMM9:LLOZZ9FT&\+ABT&\J	+BC 3222s   A9B22C	c                (   \        R RRR7      ;_uu_ 4       p\        P                  ! V.VO5/ VB pVP                  . RO4       VP	                  ^ 4       V P                  VP                  4       V4       RRR4       R#   + '       g   i     R# ; i)r   r'   r   r   r   Nr   r   r  )r   r=   rR   r   r   rZ   r   )r   expected	writeargskwwriteargsr   rR   s   &&*,  r   compare_dialect_123'TestDialectRegistry.compare_dialect_123  sg    4g>>'ZZC)C{CFOOG$LLOW\\^X6 ?>>>s   AB  B	c                    ! R  R\         P                  4      p ! R R\         P                  4      p ! R R\         P                  4      p ! R R\         P                  4      p ! R R	4      p\         P                  ! RV4        V P                  R
4       V P                  R
RR7       V P                  R
VR7       V P                  RV4       V P                  RV! 4       R7       V P                  RRR7       V P                  RVRR7       V P                  RVR7       \         P                  ! R4       R#   \         P                  ! R4       i ; i)c                       ] tR tRtRtRtR# )5TestDialectRegistry.test_dialect_apply.<locals>.testAi  r6   r   NrZ  r   r   r   testAr    r\  r   r  c                       ] tR tRtRtRtR# )5TestDialectRegistry.test_dialect_apply.<locals>.testBi  rY   r   NrZ  r   r   r   testBr        Ir   r  c                       ] tR tRtRtRtR# )5TestDialectRegistry.test_dialect_apply.<locals>.testCi  |r   NrZ  r   r   r   testCr    r  r   r  c                       ] tR tRtRtRtR# )7TestDialectRegistry.test_dialect_apply.<locals>.testUnii  u   Λr   NrZ  r   r   r   testUnir    s     Ir   r  c                       ] tR tRtRtR# );TestDialectRegistry.test_dialect_apply.<locals>.unspecifiedi  r   Nr   r   r   r   r   r   r   r   unspecifiedr    s    r   r  z1,2,3
Nr~  z1	2	3
z1:2:3
z1|2|3
z1;2;3
r  )r[   r)   u	   1Λ2Λ3
)r=   r]  rT  r  rS  )r   r  r  r  r  r  s   &     r   test_dialect_apply&TestDialectRegistry.test_dialect_apply  s!   	CII 		CII 		CII 		!cii 	!	 	 	We,	,$$[1$$[$$?$$[+$F$$]E:$$[%'$B$$['$B$$[%/2 % 4$$%:-4 % 6 ""7+C""7+s   BD: :Ec                    \         P                  ! 4        F>  p\         P                  ! V4      pV P                  \        \
        P
                  V4       K@  	  R # r   )r=   rQ  rR  r;   r<   copy)r   ra  r[   s   &  r   	test_copyTestDialectRegistry.test_copy  s9    %%'Dood+GiG< (r   c                   \         P                  ! 4        Fe  p\         P                  ! V4      p\        \        P
                  ^,           4       F(  pV P                  \        \        P                  W#4       K*  	  Kg  	  R# )r   N)	r=   rQ  rR  rangepickleHIGHEST_PROTOCOLr;   r<   dumps)r   ra  r[   protos   &   r   test_pickleTestDialectRegistry.test_pickle  sS    %%'Dood+Gv66:;!!)V\\7J < (r   r   N)r   r   r   r   rU  rd  rj  rs  rx  r  r  r  r  r  r   r    r!   s   @r   rM  rM  ,  s@     ?"
:O981
D7,<=
K Kr   rM  c                   ,   a  ] tR tRt o R tR tRtV tR# )TestCsvBasei  c                *   \        R RRR7      ;_uu_ 4       pVP                  V4       VP                  ^ 4       \        P                  ! W0P
                  R7      p\        V4      pV P                  WR4       RRR4       R#   + '       g   i     R# ; ir   r   r'   r   r~  N)r   rN   r   r=   rG   r[   r   rZ   )r   r   expected_resultr   rG   r   s   &&&   r   readerAssertEqualTestCsvBase.readerAssertEqual  sb    4'2>>'MM% LLOZZ<<@F&\FV5 ?>>>s   A BB	c                2   \        R RRR7      ;_uu_ 4       p\        P                  ! W0P                  R7      pVP	                  V4       VP                  ^ 4       V P                  VP                  4       V4       RRR4       R#   + '       g   i     R# ; ir  )r   r=   rR   r[   r   r   rZ   r   )r   r   r  r   rR   s   &&&  r   writerAssertEqualTestCsvBase.writerAssertEqual  sc    4'2>>'ZZ<<@FU#LLOW\\^_=	 ?>>>s   A$BB	r   N)r   r   r   r   r  r  r   r    r!   s   @r   r  r    s     6> >r   r  c                      a  ] tR tRt o RtR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tRtV tR# )TestDialectExceli  r]  c                .    V P                  R R ..4       R# )r   Nr  r   s   &r   test_singleTestDialectExcel.test_single      uwi0r   c                0    V P                  R . RO.4       R# )z	1,2,3,4,5N)r  2r  4r  r  r   s   &r   test_simpleTestDialectExcel.test_simple  s    {-B,CDr   c                *    V P                  R . 4       R# r'   Nr  r   s   &r   test_blanklineTestDialectExcel.test_blankline      r2&r   c                0    V P                  R RR..4       R# )rV   r'   Nr  r   s   &r   test_empty_fields"TestDialectExcel.test_empty_fields  s    sb"XJ/r   c                .    V P                  R R..4       R# )r   r'   Nr  r   s   &r   test_singlequoted"TestDialectExcel.test_singlequoted  s    trdV,r   c                0    V P                  R RR..4       R# )z"",r'   Nr  r   s   &r   test_singlequoted_left_empty-TestDialectExcel.test_singlequoted_left_empty      u2wi0r   c                0    V P                  R RR..4       R# )z,""r'   Nr  r   s   &r   test_singlequoted_right_empty.TestDialectExcel.test_singlequoted_right_empty  r  r   c                .    V P                  R R..4       R# )r   rX   Nr  r   s   &r   test_single_quoted_quote)TestDialectExcel.test_single_quoted_quote  s    vw/r   c                .    V P                  R R..4       R# )z""""""r   Nr  r   s   &r   test_quoted_quotes#TestDialectExcel.test_quoted_quotes  s    x4&2r   c                .    V P                  R R ..4       R# )za""bNr  r   s   &r   test_inline_quote"TestDialectExcel.test_inline_quote      vz2r   c                .    V P                  R R ..4       R# )za"b"cNr  r   s   &r   test_inline_quotes#TestDialectExcel.test_inline_quotes  s    w'4r   c                .    V P                  R R..4       R# )z"a"babNr  r   s   &r   test_quotes_and_more%TestDialectExcel.test_quotes_and_more  s     	vx0r   c                .    V P                  R R ..4       R# )za"bNr  r   s   &r   test_lone_quote TestDialectExcel.test_lone_quote  r  r   c                .    V P                  R R..4       R# )z"a" "b"za "b"Nr  r   s   &r   test_quote_and_quote%TestDialectExcel.test_quote_and_quote  s     	yG9+6r   c                .    V P                  R R ..4       R# )z "a"Nr  r   s   &r   test_space_and_quote%TestDialectExcel.test_space_and_quote  r  r   c                0    V P                  R . RO.4       R# )z#1,2,3,"I think, therefore I am",5,6N)r  r  r  zI think, therefore I amr  r   r  r   s   &r   test_quotedTestDialectExcel.test_quoted  s    D!+  ,	-r   c                0    V P                  R . RO.4       R# )zJ1,2,3,"""I see,"" said the blind man","as he picked up his hammer and saw"N)r  r  r  z"I see," said the blind manz"as he picked up his hammer and sawr  r   s   &r   test_quoted_quote"TestDialectExcel.test_quoted_quote  s     k!G  H	Ir   c                :    R pV P                  V. RO. RO.4       R# )zR1,2,3,"""I see,""
said the blind man","as he picked up his
hammer and saw"
9,8,7,6N)r  r  r  z"I see,"
said the blind manz"as he picked up his
hammer and saw)98r   r   r  )r   r   s   & r   test_quoted_nlTestDialectExcel.test_quoted_nl  s+    
 	u!J !2 3	4r   c                0    V P                  R . RO.4       R# )z	12,12,1",N)12r  z1"r'   r  r   s   &r   test_dubious_quote#TestDialectExcel.test_dubious_quote  s    {-C,DEr   c                *    V P                  . R 4       R# r  r  r   s   &r   	test_nullTestDialectExcel.test_null  r  r   c                .    V P                  R ..R4       R# )r   zabc
Nr  r   s   &r   test_single_writer#TestDialectExcel.test_single_writer  s    y)4r   c                0    V P                  . RO.R4       R# )r   z1,2,abc,3,4
N)r   r   r   r     r  r   s   &r   test_simple_writer#TestDialectExcel.test_simple_writer  s     346GHr   c                0    V P                  . RO.R4       R# )r   z1,2,"a""bc""",3,4
N)r   r   za"bc"r  r  r  r   s   &r   test_quotesTestDialectExcel.test_quotes       568OPr   c                .    V P                  R ..R4       R# abc,defz"abc,def"
Nr  r   s   &r   test_quote_fieldsep$TestDialectExcel.test_quote_fieldsep      }o>r   c                0    V P                  . RO.R4       R# )r   z1,2,"a
bc",3,4
N)r   r   za
bcr  r  r  r   s   &r   test_newlinesTestDialectExcel.test_newlines  s     568MNr   r   N) r   r   r   r   r[   r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r  r   r  r  r
  r  r  r   r    r!   s   @r   r  r    s     G1E'0-1103351
17
3-I
4F'5IQ?O Or   r  c                   2    ] tR tRt]P
                  tRtRtR# )EscapedExceli"  rp   r   N)	r   r   r   r   r=   r@   r2   r+   r   r   r   r   r  r  "  s    nnGJr   r  c                   :   a  ] tR tRt o ]! 4       tR tR tRtV t	R# )TestEscapedExceli&  c                .    V P                  R ..R4       R# )r  
abc\,def
Nr  r   s   &r   test_escape_fieldsep%TestEscapedExcel.test_escape_fieldsep)  r  r   c                .    V P                  R R..4       R# )r  r  Nr  r   s   &r   test_read_escape_fieldsep*TestEscapedExcel.test_read_escape_fieldsep,  s    )>r   r   N)
r   r   r   r   r  r[   r  r  r   r    r!   s   @r   r  r  &  s     nG?? ?r   r  c                   0   a  ] tR tRt o RtR tR tRtV tR# )TestDialectUnixi/  unixc                0    V P                  . RO.R4       R# )r   "1","abc def","abc"
N)r   abc defr   r  r   s   &r   r  "TestDialectUnix.test_simple_writer2  r  r   c                0    V P                  R . RO.4       R# )r%  N)r  r&  r   r  r   s   &r   test_simple_reader"TestDialectUnix.test_simple_reader5  s    69P8QRr   r   N)	r   r   r   r   r[   r  r)  r   r    r!   s   @r   r"  r"  /  s     GQS Sr   r"  c                   2    ] tR tRt]P
                  tRtRtR# )QuotedEscapedExceli8  rp   r   N)	r   r   r   r   r=   r   r2   r+   r   r   r   r   r,  r,  8  s    ""GJr   r,  c                   :   a  ] tR tRt o ]! 4       tR tR tRtV t	R# )TestQuotedEscapedExceli<  c                .    V P                  R ..R4       R# r  r  r   s   &r   test_write_escape_fieldsep1TestQuotedEscapedExcel.test_write_escape_fieldsep?  r  r   c                .    V P                  R R..4       R# )z"abc\,def"
r  Nr  r   s   &r   r  0TestQuotedEscapedExcel.test_read_escape_fieldsepB  s    0I;-@r   r   N)
r   r   r   r   r,  r[   r0  r  r   r    r!   s   @r   r.  r.  <  s      "G?A Ar   r.  c                      a  ] tR tRt o R tR tR tR tR tR t	R t
R	 tR
 tR tR tR tR tR tR tR tR tR tR tR tR tR tR tR tRtV tR# )TestDictFieldsiE  c                    \        R RRR7      ;_uu_ 4       p\        P                  ! V. ROR7      pVP                  4       pV P	                  V^
4       RRR4       R#   + '       g   i     R# ; i)r   r   r'   r   
fieldnamesNf1f2f3)r   r=   
DictWriterwriteheaderrZ   )r   r   rR   writeheader_return_values   &   r   test_writeheader_return_value,TestDictFields.test_writeheader_return_valueH  sS    4'2>>'^^G:LMF'-'9'9';$5r: ?>>>s   =AA/	c                   \        R RRR7      ;_uu_ 4       p\        P                  ! V. ROR7      pVP                  4        VP	                  ^ 4       V P                  VP                  4       R4       VP                  R^
RR/4       VP	                  ^ 4       VP                  4        V P                  VP                  4       R	4       R
R
R
4       R
#   + '       g   i     R
# ; i)r   r   r'   r   r:  r<  r7  
f1,f2,f3
r   z	10,,abc
Nr9  )	r   r=   r=  r>  r   rZ   readliner   r   r   s   &  r   test_write_simple_dict%TestDictFields.test_write_simple_dictN  s    4'2>>'^^G:LMF LLOW--/@OOT2tU34LLOW\\^]; ?>>>s   B2CC$	c           	     ,   \        4       p\        P                  ! V. R
OR7      pVP                  4        V P	                  VP                  4       R4       VP                  R ^RRRR/R ^R^RR/.4       V P	                  VP                  4       R4       R	# )r:  r;  r<  r7  rC  r   fxyzzf1,f2,f3
1,abc,f
2,5,xyz
Nr9  )r   r=   r=  r>  rZ   r   r   r   s   &  r   test_write_multiple_dict_rows,TestDictFields.test_write_multiple_dict_rowsY  s    *4FG))+^<4D%s;D!T59; 	<))+=	?r   c                d    \        4       pV P                  \        \        P                  V4       R # r   )r   r;   r<   r=   r=  r   r   s   & r   test_write_no_fields#TestDictFields.test_write_no_fieldsc  s    *)S^^W=r   c                   \        R RRR7      ;_uu_ 4       p\        P                  ! V. ROR7      pV P                  \        4      ;_uu_ 4       pVP                  R^
RR^R/4       R	R	R	4       \        XP                  4      pV P                  R
V4       V P                  RV4       V P                  RV4       V P                  RV4       R	R	R	4       R	#   + '       g   i     Lw; i  + '       g   i     R	# ; i)r   r   r'   r   r;  r7  f4spamr   Nr8  z'f4'z'f2'r  r9  )
r   r=   r=  r;   rA   r   str	exceptionassertInassertNotIn)r   r   rR   cxrT  s   &    r   #test_write_fields_not_in_fieldnames2TestDictFields.test_write_fields_not_in_fieldnamesg  s    4'2>>'^^G:LMF"":.."r4E BC /BLL)IMM,	2MM&),VY/MM#y) ?> /. ?>>s$   8C)C	'A%C)C&!C))C:	c                n    \        4       pV P                  \        \        P                  VR R.RR7       R# )r:  r;  raisedextrasactionN)r   r;   rA   r=   r=  rM  s   & r   &test_typo_in_extrasaction_raises_error5TestDictFields.test_typo_in_extrasaction_raises_errors  s/    **cnngd|'/ 	 	1r   c                V   \        4       p\        P                  ! VR R.RR7      pR^ R ^R^R^/pV P                  \        \        P                  P
                  W#4       \        P                  ! VR R.RR7      pV P                  \        \        P                  P
                  W#4       R# )r:  r;  raiser\  f0r<  RAISEN)r   r=   r=  r;   rA   r   r   r   rR   dictrows   &   r   )test_write_field_not_in_field_names_raise8TestDictFields.test_write_field_not_in_field_names_raisex  s    *$GLD!T1dA6*cnn&=&=vO $GL*cnn&=&=vOr   c                V   \        4       p\        P                  ! VR R.RR7      pR^ R ^R^R^/p\        P                  P                  W#4       V P	                  VP                  4       R4       \        P                  ! VR R.RR7      p\        P                  P                  W#4       R# )	r:  r;  ignorer\  rb  r<  z1,2
IGNOREN)r   r=   r=  r   rZ   r   rd  s   &   r   *test_write_field_not_in_field_names_ignore9TestDictFields.test_write_field_not_in_field_names_ignore  s    *$HMD!T1dA60))+Y7 $HM0r   c                    . ROp\        4       p\        P                  ! V\        V4      4      pV P	                  VP
                  V4       R# r   Nr  )r   r=   
DictReaderr   rZ   r8  r   r8  rH  rG   s   &   r   (test_dict_reader_fieldnames_accepts_iter7TestDictFields.test_dict_reader_fieldnames_accepts_iter  9    $
J4
#34**J7r   c                    . ROp\        4       p\        P                  ! W!4      pV P                  VP                  V4       R# rn  )r   r=   ro  rZ   r8  rp  s   &   r   (test_dict_reader_fieldnames_accepts_list7TestDictFields.test_dict_reader_fieldnames_accepts_list  2    $
J.**J7r   c                    . ROp\        4       p\        P                  ! V\        V4      4      pV P	                  VP
                  V4       R# rn  )r   r=   r=  r   rZ   r8  r   r8  rH  rR   s   &   r   (test_dict_writer_fieldnames_rejects_iter7TestDictFields.test_dict_writer_fieldnames_rejects_iter  rs  r   c                    . ROp\        4       p\        P                  ! W!4      pV P                  VP                  V4       R# rn  )r   r=   r=  rZ   r8  ry  s   &   r   (test_dict_writer_fieldnames_accepts_list7TestDictFields.test_dict_writer_fieldnames_accepts_list  rw  r   c                J    \        4       p\        P                  ! VR R7      pR # )Nr7  )r   r=   ro  )r   rH  rG   s   &  r   'test_dict_reader_fieldnames_is_optional6TestDictFields.test_dict_reader_fieldnames_is_optional  s    Jd3r   c                $   \        R RR7      ;_uu_ 4       pVP                  R4       VP                  ^ 4       \        P                  ! V. ROR7      pV P                  \        V4      RRRR	RR
/4       RRR4       R#   + '       g   i     R# ; i)r   r   r}  z	1,2,abc
r:  r;  r<  r7  r  r  r   Nr9  r   rN   r   r=   ro  rZ   r   r   r   rG   s   &  r   test_read_dict_fields$TestDictFields.test_read_dict_fields  sl    4'22gMM-(LLO^^G/ACFT&\D#tS$+NO 3222s   AA>>B	c                X   \        R RR7      ;_uu_ 4       pVP                  R4       VP                  ^ 4       \        P                  ! V4      pV P                  \        V4      RRRRRR	/4       V P                  VP                  . RO4       R
R
R
4       R
#   + '       g   i     R
# ; i)r   r   r}  f1,f2,f3
1,2,abc
r:  r  r;  r  r<  r   Nr9  )r   rN   r   r=   ro  rZ   r   r8  r  s   &  r   test_read_dict_no_fieldnames+TestDictFields.test_read_dict_no_fieldnames  s~    4'22gMM34LLO^^G,FT&\D#tS$+NOV..0BC 3222s   A8BB)	c                   \        R RR7      ;_uu_ 4       pVP                  R4       VP                  ^ 4       \        P                  ! V\        \        P                  ! V4      4      R7      pV P                  VP                  . RO4       V P                  \        V4      RRRR	RR
/4       RRR4       R#   + '       g   i     R# ; i)r   r   r}  r  r7  r:  r;  r<  r  r  r   Nr9  )	r   rN   r   r=   ro  r   rG   rZ   r8  r  s   &  r   #test_read_dict_fieldnames_from_file2TestDictFields.test_read_dict_fieldnames_from_file  s    4'22gMM34LLO^^G/3CJJw4G/HJFV..0BCT&\D#tS$+NO 3222s   BB77C	c                   ^ RI p\        RRR7      ;_uu_ 4       pVP                  R4       VP                  ^ 4       \        P
                  ! V4      p\        V4      pVP                  V.V4       F9  pV P                  VP                  . RO4       V P                  VRR	RR
RR/4       K;  	  RRR4       R#   + '       g   i     R# ; i)r   Nr   r   r}  r  r:  r;  r<  r  r  r   r9  )
	itertoolsr   rN   r   r=   ro  r   chainrZ   r8  )r   r  r   rG   firstrF  s   &     r   test_read_dict_fieldnames_chain.TestDictFields.test_read_dict_fieldnames_chain  s    4'22gMM34LLO^^G,FLE w7  !2!24FG  tS$T5&IJ 8 3222s   BB88C		c                (   \        R RR7      ;_uu_ 4       pVP                  R4       VP                  ^ 4       \        P                  ! VRR.R7      pV P                  \        V4      RRRRR	. R
O/4       R	R	R	4       R	#   + '       g   i     R	# ; i)r   r   r}  1,2,abc,4,5,6
r:  r;  r7  r  r  Nr   r  r  r   r  r  s   &  r   test_read_longTestDictFields.test_read_long  sx    4'22gMM-.LLO^^G04d|=FT&\D#tS-13I,K L 3222s   A B  B	c                *   \        R RR7      ;_uu_ 4       pVP                  R4       VP                  ^ 4       \        P                  ! VRR.RR7      pV P                  \        V4      RRRR	R. RO/4       R
R
R
4       R
#   + '       g   i     R
# ; i)r   r   r}  r  r:  r;  _rest)r8  restkeyr  r  Nr  r  r  s   &  r   test_read_long_with_rest'TestDictFields.test_read_long_with_rest  s{    4'22gMM-.LLO^^G04d|WNFT&\D#tS-46L,N O 3222s   A!BB	c                `   \        R RR7      ;_uu_ 4       pVP                  R4       VP                  ^ 4       \        P                  ! VRR7      pV P                  VP                  RR.4       V P                  \        V4      RRRR	R. RO/4       R
R
R
4       R
#   + '       g   i     R
# ; i)r   r   r}  zf1,f2
1,2,abc,4,5,6
r  r  r:  r;  r  r  Nr  )r   rN   r   r=   ro  rZ   r8  r   r  s   &  r   &test_read_long_with_rest_no_fieldnames5TestDictFields.test_read_long_with_rest_no_fieldnames  s    4'22gMM67LLO^^GW=FV..t=T&\D#tS-46L,N O 3222s   A<BB-	c                   \        R RR7      ;_uu_ 4       pVP                  R4       VP                  ^ 4       \        P                  ! VRP                  4       RR7      pV P                  \        V4      RRRRR	R
RRRRRR/4       V P                  \        V4      RRRRR	R
RRRRRR/4       RRR4       R#   + '       g   i     R# ; i)r   r   r}  z1,2,abc,4,5,6
1,2,abc
1 2 3 4 5 6DEFAULT)r8  restvalr  r  r  r   r  r  r   N)r   rN   r   r=   ro  splitrZ   r   r  s   &  r   test_read_shortTestDictFields.test_read_short  s    4'22gMM89LLO^^G/</B/B/D,57F T&\Cc3U-0#sCc,K LT&\Cc3U-0)S)-0),= > 3222s   BB88C		c                    . ROp\         P                  ! VRP                  4       R7      pV P                  \	        V4      RRRRRRR	R
RR/4       R# )2147483648,43.0e12,17,abc,def
zi1 float i2 s1 s2r7  i1
2147483648floatz43.0e12i217s1r   s2r  N)r  z147483648,43.0e2,17,abc,def
z47483648,43.0,170,abc,def
r=   ro  r  rZ   r   )r   samplerG   s   &  r   test_read_multiTestDictFields.test_read_multi  sY     +>+D+D+FHfl)0))-t)-u)-u	(6 	7r   c                    \         P                  ! . RORP                  4       R7      pV P                  \	        V4      RRRRRRRRRRR	R	/4       V P                  \	        V4      RRRRRRRRRRR	R	/4       R
# )r  r  r7  r  r  r  r   r  r  r   N)r  rW   r  r  r   rG   s   & r   test_read_with_blanks$TestDictFields.test_read_with_blanks  s     !6+8+>+>+@B 	fS#sC),c3S#(G 	HfS#sC),c3S#(G 	Hr   c                    \         P                  ! R .RP                  4       RR7      pV P                  \	        V4      RRRRRRRRR	R	R
R
/4       R# )z1;2;abc;4;5;6
r  r  )r8  r)   r  r  r  r   r  r  r   Nr  r  s   & r   test_read_semi_sep!TestDictFields.test_read_semi_sep  s[    !4 5+8+>+>+@*-/ 	fS#sC),c3S#(G 	Hr   r   N)r   r   r   r   r@  rE  rJ  rN  rX  r^  rf  rk  rq  ru  rz  r}  r  r  r  r  r  r  r  r  r  r  r  r  r   r    r!   s   @r   r5  r5  E  s     ;	<?>
*1
P	188884PDP	KLOO>7HH Hr   r5  c                   8   a  ] tR tRt o R tR tR tR tRtV t	R# )TestArrayWritesi  c           
        ^ RI p\        ^4       Uu. uF  p^V,
          NK  	  ppVP                  RV4      p\        RRRR7      ;_uu_ 4       p\        P                  ! VRR7      pVP                  V4       R	P                  V Uu. uF  p\        V4      NK  	  up4      R
,           pVP                  ^ 4       V P                  VP                  4       V4       RRR4       R# u upi u upi   + '       g   i     R# ; i)r   Nr   r   r   r'   r   r]  r~  rV   rW   arrayr  r   r=   rR   r   joinrS  r   rZ   r   r   r  r   contentsr   r   rR   r  s   &       r   test_int_writeTestArrayWrites.test_int_write  s    $)"I.IqRTTI.KKX&4'2>>'ZZ9FOOAxx 3AQ 34V;HLLOW\\^X6 ?> / !4 ?>>s#   C$9C.C)?C.)C..C?	c           
        ^ RI p\        ^4       Uu. uF  p^V,
          R,          NK  	  ppVP                  RV4      p\        RRRR7      ;_uu_ 4       p\        P                  ! VRR	7      pVP                  V4       R
P                  V Uu. uF  p\        V4      NK  	  up4      R,           pVP                  ^ 4       V P                  VP                  4       V4       RRR4       R# u upi u upi   + '       g   i     R# ; i)r   N皙?r   r   r   r'   r   r]  r~  rV   rW   r  r  s   &       r   test_double_write!TestArrayWrites.test_double_write#      (-b	2	1RT3JJ	2KKX&4'2>>'ZZ9FOOAxx 3AQ 34V;HLLOW\\^X6 ?> 3
 !4 ?>>#   C+9C5C0"?C50C55D	c           
        ^ RI p\        ^4       Uu. uF  p^V,
          R,          NK  	  ppVP                  RV4      p\        RRRR7      ;_uu_ 4       p\        P                  ! VRR	7      pVP                  V4       R
P                  V Uu. uF  p\        V4      NK  	  up4      R,           pVP                  ^ 4       V P                  VP                  4       V4       RRR4       R# u upi u upi   + '       g   i     R# ; i)r   Nr  rH  r   r   r'   r   r]  r~  rV   rW   r  r  s   &       r   test_float_write TestArrayWrites.test_float_write.  r  r  c                   ^ RI p^ RIpVP                  RVP                  4      p\        RRRR7      ;_uu_ 4       p\        P
                  ! VRR7      pVP                  V4       R	P                  V4      R
,           pVP                  ^ 4       V P                  VP                  4       V4       RRR4       R#   + '       g   i     R# ; i)r   Nwr   r   r'   r   r]  r~  rV   rW   )r  stringascii_lettersr   r=   rR   r   r  r   rZ   r   )r   r  r  r   r   rR   r  s   &      r   test_char_writeTestArrayWrites.test_char_write9  s    KKV1124'2>>'ZZ9FOOAxx{6)HLLOW\\^X6 ?>>>s   A3B88C		r   N)
r   r   r   r   r  r  r  r  r   r    r!   s   @r   r  r    s     
7	7	7	7 	7r   r  c                   >   a  ] tR tRt o R tR tR tR tR tRt	V t
R# )	TestDialectValidityiD  c                    ! R  R\         P                  4      pV! 4       pV P                  VP                  \         P                  4       RVn        V P                  \         P                  V4       ^*Vn        V P                  \         P                  4      ;_uu_ 4       pV! 4        RRR4       V P                  \        XP                  4      R4       RVn	        \         P                  Vn        RVn        V! 4       pV P                  VP                  \         P                  4       V P                  VP                  R4       V P                  VP                  4       RVn        V P                  \         P                  4      ;_uu_ 4       pV! 4        RRR4       V P                  \        VP                  4      R4       RVn        V P                  \         P                  4      ;_uu_ 4       pV! 4        RRR4       V P                  \        VP                  4      R	4       ^Vn        V P                  \         P                  4      ;_uu_ 4       pV! 4        RRR4       V P                  \        VP                  4      R
4       R#   + '       g   i     EL; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     Lr; i)c                   B    ] tR tRtRtRtRtRtRt]	P                  tRtR# )	3TestDialectValidity.test_quoting.<locals>.mydialectiF  r  rp   FTrW   r   Nr   r   r   r   r)   r+   r]   r8   r0   r=   r@   r2   r   r   r   r   ro  r  F  %    IJK##NnnGr   ro  Nzbad "quoting" valueTrX   r'   zI"quotechar" must be a unicode character or None, not a string of length 0z''zI"quotechar" must be a unicode character or None, not a string of length 2z8"quotechar" must be a unicode character or None, not int)r=   rr  rZ   r2   r@   r;   r>   rS  rT  r]   r?   r-   
assertTruer   ro  r   cms   &   r   test_quoting TestDialectValidity.test_quotingE  s   	% 	% KCNN3 	#))Y/	syy))RK *R\\*.	0 !%	MM	!	KCMM2c*& 	syy))RK *R\\*4	5 #	syy))RK *R\\*4	5  	syy))RK *R\\*#	$= *)) *)) *) *)s0    JJ1J3KJ	J0	3K	K	c                     ! R  R\         P                  4      pV! 4       pV P                  VP                  R4       RVn        V P	                  \         P
                  4      ;_uu_ 4       pV! 4        RRR4       V P                  \        XP                  4      R4       RVn        V P	                  \         P
                  4      ;_uu_ 4       pV! 4        RRR4       V P                  \        VP                  4      R4       RVn        V P	                  \         P
                  4      ;_uu_ 4       pV! 4        RRR4       V P                  \        VP                  4      R	4       ^Vn        V P	                  \         P
                  4      ;_uu_ 4       pV! 4        RRR4       V P                  \        VP                  4      R
4       RVn        V P	                  \         P
                  4      ;_uu_ 4       pV! 4        RRR4       V P                  \        VP                  4      R4       R#   + '       g   i     EL; i  + '       g   i     ELu; i  + '       g   i     EL&; i  + '       g   i     L; i  + '       g   i     L; i)c                   B    ] tR tRtRtRtRtRtRt]	P                  tRtR# )	5TestDialectValidity.test_delimiter.<locals>.mydialectiw  r  rp   FTrW   r   Nr  r   r   r   ro  r  w  r  r   ro  r  :::NzA"delimiter" must be a unicode character, not a string of length 3r'   zA"delimiter" must be a unicode character, not a string of length 0   ,z2"delimiter" must be a unicode character, not bytesz0"delimiter" must be a unicode character, not intz5"delimiter" must be a unicode character, not NoneType)r=   rr  rZ   r)   r;   r>   rS  rT  r  s   &   r   test_delimiter"TestDialectValidity.test_delimiterv  s   	% 	% Kc*#	syy))RK *R\\*4	5 !	syy))RK *R\\*\	^ #	syy))RK *R\\*M	O  	syy))RK *R\\*K	M #	syy))RK *R\\*P	R7 *)) *)) *)) *) *)s<   +H.I1II*7I=.H?	I	I'	*I:	=J	c                2    ! R  R\         P                  4      pV! 4       pV P                  VP                  R4       RVn        V P	                  \         P
                  4      ;_uu_ 4       pV! 4        RRR4       V P                  \        XP                  4      R4       RVn        V P	                  \         P
                  4      ;_uu_ 4       pV! 4        RRR4       V P                  \        VP                  4      R4       RVn        V P	                  \         P
                  4      ;_uu_ 4       pV! 4        RRR4       V P                  \        VP                  4      R	4       ^Vn        V P	                  \         P
                  4      ;_uu_ 4       pV! 4        RRR4       V P                  \        VP                  4      R
4       R#   + '       g   i     ELa; i  + '       g   i     EL; i  + '       g   i     L; i  + '       g   i     Lr; i)c                   B    ] tR tRtRtRtRtRtRt]	P                  tRtR# )	6TestDialectValidity.test_escapechar.<locals>.mydialecti  r  rp   FTrW   r   Nr  r   r   r   ro  r    r  r   ro  rp   r'   NzJ"escapechar" must be a unicode character or None, not a string of length 0z**zJ"escapechar" must be a unicode character or None, not a string of length 2   *z;"escapechar" must be a unicode character or None, not bytesz9"escapechar" must be a unicode character or None, not int)r=   rr  rZ   r+   r;   r>   rS  rT  r  s   &   r   test_escapechar#TestDialectValidity.test_escapechar  s{   	% 	% Kt,!	syy))RK *R\\*4	5  $	syy))RK *R\\*4	5  $	syy))RK *R\\*%	&  !	syy))RK *R\\*#	$/ *)) *)) *) *)s0   +GG1G3HG	G0	3H	H	c                    ! R  R\         P                  4      pV! 4       pV P                  VP                  R4       RVn        V! 4       pV P                  VP                  R4       ^Vn        V P	                  \         P
                  4      ;_uu_ 4       pV! 4        RRR4       V P                  \        XP                  4      R4       RVn        V P	                  \         P
                  4      ;_uu_ 4       pV! 4        RRR4       V P                  \        VP                  4      R4       R#   + '       g   i     L; i  + '       g   i     LJ; i)c                   B    ] tR tRtRtRtRtRtRt]	P                  tRtR# )	:TestDialectValidity.test_lineterminator.<locals>.mydialecti  r  rp   FTrW   r   Nr  r   r   r   ro  r    r  r   ro  rW   r  Nz*"lineterminator" must be a string, not intz/"lineterminator" must be a string, not NoneType)r=   rr  rZ   r0   r;   r>   rS  rT  r  s   &   r   test_lineterminator'TestDialectValidity.test_lineterminator  s    	% 	% K))62#(	 K))51#$	 syy))RK *R\\*E	G $(	 syy))RK *R\\*J	L *) *)s   D/8E/D?	E	c                2   R  pR F  pV P                  VR7      ;_uu_ 4        V P                  \        P                  WR4       V P                  \        P                  WR4       V P                  \        P                  WR4       V P                  \        P                  W^4       V P                  \        WR4       V P                  \        WR4       VR8w  d   V P                  \        WRR	R
7       RRR4       K  	  R#   + '       g   i     EK  ; i)c                      ! R  R\         P                  4      p\        W0V4       VP                  4        F  w  r\        W0V4       K  	  V! 4       pR# )c                   :    ] tR tRtRt]P                  tRtRt	Rt
R# )QTestDialectValidity.test_invalid_chars.<locals>.create_invalid.<locals>.mydialecti  rV   rX   rW   r   N)r   r   r   r   r)   r=   r?   r2   r-   r0   r   r   r   r   ro  r    s    	--	!'r   ro  N)r=   rr  rb   items)
field_namevaluers   ro  r   s   &&,  r   create_invalid>TestDialectValidity.test_invalid_chars.<locals>.create_invalid  sB    (CKK (
 I51%+\\^!
	u5 &4Ar   r)   )r  r'   r      xr3   r4   r5   Tr"  N)r)   r+   r-   )r   r;   r=   r>   rA   )r   r  r  s   &  r   test_invalid_chars&TestDialectValidity.test_invalid_chars  s    		 CJ44!!#))^L!!#))^O!!#))^N!!#))^K!!*n$O!!*n$O,%%j.c7; & = 54 C444s   CDDr   N)r   r   r   r   r  r  r  r  r  r   r    r!   s   @r   r  r  D  s(     /$b(RT%$NL6= =r   r  c                      a  ] tR tRt o RtRtRtRtRtRt	Rt
R	tR
tRtRt]! R4      t]! R4      t]! R4      t]! R4      tRtR tR tR tR tR tR tR tR tRtV tR# )TestSnifferi  zHarry's, Arlington Heights, IL, 2/1/03, Kimi Hayes
Shark City, Glendale Heights, IL, 12/28/02, Prezence
Tommy's Place, Blue Island, IL, 12/28/02, Blue Sunday/White Crow
Stonecutters Seafood and Chop House, Lemont, IL, 12/19/02, Week Back
a  'Harry''s':'Arlington Heights':'IL':'2/1/03':'Kimi Hayes'
'Shark City':'Glendale Heights':'IL':'12/28/02':'Prezence'
'Tommy''s Place':'Blue Island':'IL':'12/28/02':'Blue Sunday/White Crow'
'Stonecutters ''Seafood'' and Chop House':'Lemont':'IL':'12/19/02':'Week Back'
z+"venue","city","state","date","performers"
z05/05/03?05/05/03?05/05/03?05/05/03?05/05/03?05/05/03
05/05/03?05/05/03?05/05/03?05/05/03?05/05/03?05/05/03
05/05/03?05/05/03?05/05/03?05/05/03?05/05/03?05/05/03
zT2147483648;43.0e12;17;abc;def
147483648;43.0e2;17;abc;def
47483648;43.0;170;abc;def
zaaa	bbb
AAA	
BBB	
za|b|c
d|e|f
z'a'|'b'|'c'
'd'|e|f
z+"venue"+"city"+"state"+"date"+"performers"
zHarry's+ Arlington Heights+ IL+ 2/1/03+ Kimi Hayes
Shark City+ Glendale Heights+ IL+ 12/28/02+ Prezence
Tommy's Place+ Blue Island+ IL+ 12/28/02+ Blue Sunday/White Crow
Stonecutters Seafood and Chop House+ Lemont+ IL+ 12/19/02+ Week Back
a  'Harry''s'+ Arlington Heights'+ 'IL'+ '2/1/03'+ 'Kimi Hayes'
'Shark City'+ Glendale Heights'+' IL'+ '12/28/02'+ 'Prezence'
'Tommy''s Place'+ Blue Island'+ 'IL'+ '12/28/02'+ 'Blue Sunday/White Crow'
'Stonecutters ''Seafood'' and Chop House'+ 'Lemont'+ 'IL'+ '12/19/02'+ 'Week Back'
z|
                        abc,def
                        ghijkl,mno
                        ghi,jkl
                        z~
                        abc,def
                        ghijkl,mnop
                        ghi,jkl
                         z"time","forces"
                        1,1.5
                        0.5,5+0j
                        0,0
                        1+1j,6
                        z|"time","forces"
                        0,0
                        1,2
                        a,b
                        zabc def
ghijkl mno
ghi jkl
c                    \         P                  ! 4       pV P                  VP                  V P                  4      4       V P                  VP                  V P                  4      4       R # r   )r=   Snifferr  
has_headersample12assertFalsesample13r   sniffers   & r   test_issue43625TestSniffer.test_issue43625L  sE    ++-**4==9:++DMM:;r   c                    \         P                  ! 4       pV P                  VP                  V P                  4      4       V P                  VP                  V P
                  4      4       R # r   )r=   r  r  r  sample10sample11r  s   & r   test_has_header_strings#TestSniffer.test_has_header_stringsQ  sG    ++-++DMM:;++DMM:;r   c                    \         P                  ! 4       pV P                  VP                  V P                  4      R 4       V P                  VP                  V P
                  V P                  ,           4      R4       R# FTN)r=   r  r\   r  sample1header1r  s   & r   test_has_headerTestSniffer.test_has_headerW  P    ++-g((6>g(()DEtLr   c                    \         P                  ! 4       pV P                  VP                  V P                  4      R 4       V P                  VP                  V P
                  V P                  ,           4      R4       R# r  )r=   r  r\   r  sample8header2r  s   & r   'test_has_header_regex_special_delimiter3TestSniffer.test_has_header_regex_special_delimiter\  r  r   c                   \         P                  ! 4       pR F  pV P                  V4      ;_uu_ 4        VP                  VR4      pV P	                  VP
                  R4       V P	                  VP                  R4       V P                  VP                  R4       V P                  VP                  R4       RRR4       K  	  R#   + '       g   i     K  ; i)	;'123;4';z,;r  rq  FN)r  z'123;4';z;'123;4'z'123;4')
r=   r  r   sniffrZ   r)   r-   r\   r]   r8   )r   r	  headerr[   s   &   r   test_guess_quote_and_delimiter*TestSniffer.test_guess_quote_and_delimitera  s    ++-FFf%%!--5  !2!2C8  !2!2C8g1159g66> &% G%%%s   BCCc                   \         P                  ! 4       pVP                  V P                  4      pV P	                  VP
                  R 4       V P	                  VP                  R4       V P                  VP                  R4       VP                  V P                  4      pV P	                  VP
                  R4       V P	                  VP                  R4       V P                  VP                  R4       R# )rV   rX   TrY   rq  FN)
r=   r  r  r  rZ   r)   r-   r\   r8   sample2r   r	  r[   s   &  r   
test_sniffTestSniffer.test_sniffk  s    ++----**C0**C0g..5---**C0**C0g..6r   c                   \         P                  ! 4       pVP                  V P                  4      pV P	                  VP
                  V P                  4       VP                  V P                  R R7      pV P                  VP
                  R4       VP                  V P                  RR7      pV P                  VP
                  R4       VP                  V P                  4      pV P                  VP
                  R4       VP                  V P                  4      pV P                  VP
                  R4       VP                  V P                  4      pV P                  VP
                  R4       VP                  V P                  4      pV P                  VP
                  R4       V P                  VP                  R4       VP                  V P                  4      pV P                  VP
                  R	4       VP                  V P                  4      pV P                  VP
                  R	4       V P                  VP                  R4       VP                  V P                  4      pV P                  VP
                  R
4       R# )z?,)
delimiters?z/,/r  r6   r  rq  +r   N)r=   r  r  sample3rU  r)   rZ   sample4sample5sample6sample7r-   r  sample9sample14r%  s   &  r   test_delimitersTestSniffer.test_delimitersw  s   ++---- 	g''6--->**C0--->**C0---**C0---**D1---**C0---**C0**C0---**C0---**C0**C0--.**D1r   c                L   \         P                  ! 4       pVP                  V P                  4      pV P	                  VP
                  4       VP                  V P                  4      pV P	                  VP
                  4       VP                  V P                  4      pV P                  VP
                  4       VP                  V P                  4      pV P	                  VP
                  4       VP                  V P                  4      pV P                  VP
                  4       R # r   )r=   r  r  r  r  r]   r  r$  r  r  r2  r%  s   &  r   test_doublequoteTestSniffer.test_doublequote  s    ++----,,----,,----++,---,,----++,r   r   N)r   r   r   r   r  r$  r  r-  r.  r/  r0  r1  r  r  r2  r   r  r  r  r  r3  r
  r  r  r  r!  r&  r4  r7  r   r    r!   s   @r   r  r    s     GGGGG /G"G*GGGG   H   H   H   HH<
<M
M
?
728- -r   r  c                   *   a  ] tR tRt o R t]tRtV tR# )NULi  c                    R # r   r   )src   s   &*r   rN   	NUL.write  s    r   r   N)r   r   r   r   rN   
writelinesr   r    r!   s   @r   r:  r:    s     Jr   r:  gettotalrefcountzrequires sys.gettotalrefcount()c                   8   a  ] tR tRt o R tR tR tR tRtV t	R# )	TestLeaksi  c                   ^ p\         P                  ! 4       p\        ^4       F  p\        P                  ! 4        V P                  \        P                  . 4       \         P                  ! 4       p\        P                  ! R.4       \        P                  ! R.4       \        P                  ! R.4       WB,
          pTpK  	  V P                  V^4       R# r   za,b,c
N
sysr?  r  gccollectrZ   garbager=   rG   
assertLess)r   deltalastrcr   rcs   &    r   test_create_readTestLeaks.test_create_read  s    %%'rAJJLRZZ,%%'BJJ}%JJ}%JJ}%IEF  	q!r   c                   ^ p\         P                  ! 4       p\        4       p\        ^4       F  p\        P
                  ! 4        V P                  \        P                  . 4       \         P                  ! 4       p\        P                  ! V4       \        P                  ! V4       \        P                  ! V4       WR,
          pTpK  	  V P                  V^4       R# )r   N)rE  r?  r:  r  rF  rG  rZ   rH  r=   rR   rI  )r   rJ  rK  r<  r   rL  s   &     r   test_create_writeTestLeaks.test_create_write  s    %%'ErAJJLRZZ,%%'BJJqMJJqMJJqMIEF  	q!r   c                v   ^ pR.^,          p\         P                  ! 4       p\        ^4       Fv  p\        P                  ! 4        V P                  \        P                  . 4       \         P                  ! 4       p\        P                  ! V4      pV F  pK  	  WS,
          pTpKx  	  V P                  V^4       R# rC  rD  )r   rJ  rE  rK  r   rL  rdrrF  s   &       r   	test_readTestLeaks.test_read  s    }Q%%'rAJJLRZZ,%%'B**T"C IEF  	q!r   c                   ^ p. RO.^,          p\        4       p\        P                  ! 4       p\        ^4       F  p\        P
                  ! 4        V P                  \        P                  . 4       \        P                  ! 4       p\        P                  ! V4      pV F  pVP                  V4       K  	  Wd,
          pTpK  	  V P                  V^4       R# )r   Nr  )r:  rE  r?  r  rF  rG  rZ   rH  r=   rR   r   rI  )	r   rJ  rE  r<  rK  r   rL  rR   rF  s	   &        r   
test_writeTestLeaks.test_write  s    y{E%%'rAJJLRZZ,%%'BZZ]F$ IEF  	q!r   r   N)
r   r   r   r   rM  rP  rT  rW  r   r    r!   s   @r   rA  rA    s     "" " " "r   rA  c                   4   a  ] tR tRt o . ROtR tR tRtV tR# )TestUnicodei  c                h   \        R RRR7      ;_uu_ 4       pVP                  RP                  V P                  4      R,           4       VP	                  ^ 4       \
        P                  ! V4      pV P                  \        V4      V P                  .4       RRR4       R#   + '       g   i     R# ; ir   r'   r   r  rV   rW   N)	r   rN   r  namesr   r=   rG   rZ   r   r  s   &  r   test_unicode_readTestUnicode.test_unicode_read  ss    4g>>'MM#((4::.78LLOZZ(FT&\DJJ<8	 ?>>>s   A?B  B1	c                t   \        R RRR7      ;_uu_ 4       p\        P                  ! V4      pVP                  V P                  4       RP                  V P                  4      R,           pVP                  ^ 4       V P                  VP                  4       V4       RRR4       R#   + '       g   i     R# ; ir\  )	r   r=   rR   r   r]  r  r   rZ   r   )r   r   rR   r  s   &   r   test_unicode_writeTestUnicode.test_unicode_write  sx    4g>>'ZZ(FOODJJ'xx

+F2HLLOW\\^X6 ?>>>s   BB&&B7	r   N)u   Martin von Löwisu   Marc André LemburgzGuido van Rossumu   François Pinard)	r   r   r   r   r]  r^  ra  r   r    r!   s   @r   rZ  rZ    s     !E
97 7r   rZ  c                   ,   a  ] tR tRt o R tR tRtV tR# )KeyOrderingTesti  c                   \        4       p\        R 4       F  p\        RRRR7      ;_uu_ 4       p\        P                  ! W24      pVP                  4        VP                  ^ 4       \        P                  ! V4      p\        VP                  4      pV P                  W&4       VP                  V4       RRR4       K  	  V P                  \        V4      ^xR4       R#   + '       g   i     K  ; i)abcder   r'   r   r  Nz@Key ordering: some key permutations not collected (expected 120))setr   r   r=   r=  r>  r   ro  tupler8  rZ   addlen)r   	resultsetkeys
fileobjectdwdrkts   &      r   ,test_ordering_for_the_dict_reader_and_writer<KeyOrderingTest.test_ordering_for_the_dict_reader_and_writer  s    E	 )DtR'BBj^^J5 "^^J/2==)  *b! CB * 	Y.pq CBBs   BCC/c                   \        R 4      P                  4       pV P                  \        \        P
                  ! V4      4      \        R	R
.4      \        RRRRR.3.4      \        RR.4      \        RR.4      .4       V P                  \        \        P
                  ! VRR7      4      \        R	R
.4      \        RRRRR.3.4      \        RR.4      \        RR.4      .4       V^  V P                  \        \        P
                  ! VRR.R7      4      \        RR.4      \        RRRRR.3.4      \        RR.4      \        RR.4      .4       R# )z            FirstName,LastName
            Eric,Idle
            Graham,Chapman,Over1,Over2

            Under1
            John,Cleese
        NOver1Over2	OtherInfor  fnamelnamer7  )	FirstNameEric)LastNameIdle)ry  Graham)r{  Chapman)ry  Under1)r{  N)ry  John)r{  Cleese)rw  rz  )rx  r|  )rw  r}  )rx  r~  )rw  r  )rx  N)rw  r  )rx  r  )r   
splitlinesrZ   r   r=   ro  r   )r   datas   & r   test_ordered_dict_reader(KeyOrderingTest.test_ordered_dict_reader  s      Z\ 	 	cnnT23/1EFG13J'7!346 713EFG/1GHI		 	cnnT;GH/1EFG13J&'(:;= >13EFG/1GHI		 GcnnTw>PQR+->?@-/C'7!346 7-?@+-@AB		r   r   N)r   r   r   r   rq  r  r   r    r!   s   @r   rd  rd    s     r! !r   rd  c                   `   a  ] tR tRt o R t]R 4       tR t]P
                  R 4       t	Rt
V tR# )MiscTestCasei3  c                >    \         P                  ! V \        R4       R# )r=   N)r=   _csv)r   check__all__r=   r   s   &r   test__all__MiscTestCase.test__all__4  s    T38r   c                     \        R R04       R# )r=   reNr	   r   s   &r   test_lazy_importMiscTestCase.test_lazy_import7  s    ED6*r   c                8     ! R  R\         P                  4      pR# )c                       ] tR tRtRtR# )+MiscTestCase.test_subclassable.<locals>.Fooi=  r   Nr  r   r   r   Foor  =  s    cr   r  N)r=   r>   )r   r  s   & r   test_subclassableMiscTestCase.test_subclassable;  s    !#))!r   c                    \         P                  ! R 4      pVP                  VP                  3 F1  pV P	                  VR7      ;_uu_ 4        \        W4       RRR4       K3  	  R#   + '       g   i     KH  ; i)r  )tpN)r   import_moduleReaderWriterr   r   )r   r  r  s   &  r   test_disallow_instantiation(MiscTestCase.test_disallow_instantiation?  sT    **62++t{{*B$$,T6 %$ +$$$s   A&&A7r   N)r   r   r   r   r  r   r  r  r   r  r   r    r!   s   @r   r  r  3  s=     9 + +" 7 7r   r  __main__)1r  rE  unittestior   tempfiler   r=   rF  r  testr   test.supportr   r   r   test.support.import_helperr
   r  r   textwrapr   collectionsr   r   TestCaser$   rM  r  r  r]  r  r  r"  r,  r.  r5  r  r  r  r:  
skipUnlesshasattrrA  rZ  rd  r  r   mainr   r   r   <module>r     s    
   " 
 	   R R : "  # 
P7x   P7fCK(++ CKJ>(## > _O{ _OB399 ?{ ?Sk S A[ AOHX&& OHb,7h'' ,7\t=(++ t=nc-(## c-J 
 
WS"4568?"!! ?"8?"B7(## 7.1h'' 1h78$$ 7& zMMO r   