1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
U
­ý°d¤ã@sºdZddlmZddlZddlZddlmZmZm    Z    m
Z
m Z m Z ddl mZej d¡Zdd„Zdd    „Zd
d „Zd d „Zdd„Zdd„Zdd„Zdd„Zej dejeddgejdfdeegƒegƒdœƒfdddœeegƒegƒdœƒfdeddgddfdee gdde gdddœƒfejejdœee gejde gejddœƒfejejdœee gejde gejddœƒfejejd œee gejde gejddœƒfg¡d!d"„ƒZdS)#zW
Tests dtype specification during parsing
for all of the parsers defined in parsers.py
é)ÚStringION)Ú CategoricalÚ    DataFrameÚIndexÚ
MultiIndexÚSeriesÚconcatZ pyarrow_skipcCs8|}|jtdƒtd}tggdœtd}t ||¡dS)NzA,B©Údtype)ÚAÚB)Úread_csvrÚstrrÚtmÚassert_frame_equal)Ú all_parsersÚparserÚresultÚexpected©rú_d:\z\workplace\vscode\pyvenv\venv\Lib\site-packages\pandas/tests/io/parser/dtypes/test_empty.pyÚtest_dtype_all_columns_emptysrcCsP|}d}|jt|ƒddid}ttjdddtjdtddœƒ}t ||¡dS)Núone,twoÚoneÚu1r    r)rÚtwo)r rrÚnpÚemptyÚobjectrr©rrÚdatarrrrrÚtest_empty_pass_dtype!sÿr!cCsX|}d}|jt|ƒdgdddœd}tdtjddd    itgddd
d }t ||¡dS) NrrrÚf©ré©Z    index_colr
rrr    )r
Úname©Úindex)r rrrrrrrrrrrÚ test_empty_with_index_pass_dtype-sÿ ÿr)cCs||}d}|jt|ƒddgdddœd}tjtjddd    tjdtjd    gddgd
}td tjdtd    i|d }t     
||¡dS) Nz one,two,threerrrZf8r#r%rr    )ÚnamesZthreer') r rrZ from_arraysrrÚfloat64rrrr)rrr rZexp_idxrrrrÚ&test_empty_with_multi_index_pass_dtype;sÿþr,cCsR|}d}|jt|ƒdddœd}ttjdddtjddddœƒ}t ||¡dS)Núone,onerr"©rúone.1r    r©r rrrrrrrrrrÚ2test_empty_with_mangled_column_pass_dtype_by_namesKsÿr1cCsR|}d}|jt|ƒdddœd}ttjdddtjddddœƒ}t ||¡dS)Nr-rr"©rr$r    rr.r0rrrrÚ4test_empty_with_mangled_column_pass_dtype_by_indexesWsÿr3cCsT|}ttgdddtgdddgdd}d}|jt|ƒddd    œd
}t ||¡dS) Nrr©r&r
r/r"r$©Zaxisr-r2r    )rrr rrr)rrrr rrrrÚ0test_empty_with_dup_column_pass_dtype_by_indexescsþr6c    Csv|}ttgdddtgdddgdd}|j t¡|_tjtdd    (d
}|jt    |ƒddgddd œd W5QRXdS) Nrrr4r/r"r$r5zDuplicate names)ÚmatchÚr2)r*r
)
rrr(ZastyperÚpytestZraisesÚ
ValueErrorr r)rrrr rrrÚ7test_empty_with_dup_column_pass_dtype_by_indexes_raisespsþr;zdtype,expectedÚaÚb)Úcolumnsr
Úcategory)r<r=zdatetime64[ns]ztimedelta64[ns]r    r2)r<r$cCs,|}d}|jt|ƒd|d}t ||¡dS)Nza,br)Úheaderr
)r rrr)rr
rrr rrrrÚtest_empty_dtype~s,rA) Ú__doc__ÚiorÚnumpyrr9ZpandasrrrrrrZpandas._testingZ_testingrÚmarkZ usefixturesZ
pytestmarkrr!r)r,r1r3r6r;Z parametrizer+Úint64Úint32rArrrrÚ<module>sb            þþ
 
þÿþ
ÿþ ÿþ ÿþàþ*